|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
creating an array as property of a classHi
does anyone know how to create an array as property of a class ? can such an array be redimed ? Thanx John "John Devlon" <johndev***@hotmail.com> schrieb: \\\> does anyone know how to create an array as property of a class ? Private m_Names() As String Public Property Names() As String() Get Return m_Names End Get Set(ByVal Value() As String) m_Names = Value End Set End Property /// > can such an array be redimed ? Yes. The property only provides access to the array object.-- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/> Dear Mr. Wagner,
your the best, it works like a charme ... John Show quoteHide quote "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> schreef in bericht news:Ol1HcYeQFHA.924@TK2MSFTNGP14.phx.gbl... > "John Devlon" <johndev***@hotmail.com> schrieb: >> does anyone know how to create an array as property of a class ? > > \\\ > Private m_Names() As String > > Public Property Names() As String() > Get > Return m_Names > End Get > Set(ByVal Value() As String) > m_Names = Value > End Set > End Property > /// > >> can such an array be redimed ? > > Yes. The property only provides access to the array object. > > -- > M S Herfried K. Wagner > M V P <URL:http://dotnet.mvps.org/> > V B <URL:http://classicvb.org/petition/> John,
Although nothing is impossible you would not want this. The nicest way when you are building classes is in my opinion the use of the CollectionBase and that extended when sort is needed with IComparer. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemcollectionscollectionbaseclasstopic.asp I hope this helps, Cor "Cor Ligthert" <notmyfirstn***@planet.nl> schrieb: Why not? Using array properties is a common practice which is used in the > Although nothing is impossible you would not want this. ..NET Framework too (e.g. 'Environment.GetLogicalDrives'). -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/> Herfried,
> Why not? Using array properties is a common practice which is used in the I never will use a fixed array that has to be redimed.> .NET Framework too (e.g. 'Environment.GetLogicalDrives'). > When there was not the asked redim I did not see any disadvantage. Cor |
|||||||||||||||||||||||