PC Review


Reply
Thread Tools Rate Thread

ArrayList Strongly Typed

 
 
=?Utf-8?B?RGVubmlz?=
Guest
Posts: n/a
 
      25th Mar 2005
I use the following code for a strongly typed arraylist and it works great.
However, I was wondering if this is the proper way to do it. I realize that
if I want to implement sorting of the arraylist then I have to handle this
with a sort method that uses comparer. I can reference the properties of the
Arraylist directly such as

dim mylist as new FrameList
mylist.Add(new FrameStructure)
mylist(0).first = "blabla..."
mylist(0).second = "bla2 bla2..."

'Strongly typed arraylist class "FrameList"
Friend Class FrameList
Inherits ArrayList
Default Public Shadows Property Item(ByVal Index As Integer) As
FrameStructure
Get
Return DirectCast(MyBase.Item(Index), FrameStructure)
End Get
Set(ByVal Value As FrameStructure)
MyBase.Item(Index) = Value
End Set
End Property
End Class
public class FrameStructure
public first as string
public second as string
end class
--
Dennis in Houston
 
Reply With Quote
 
 
 
 
J L
Guest
Posts: n/a
 
      25th Mar 2005
Hi Dennis,
I am a .Net newbie so let me ask...why go to the trouble of creating
the FrameList class? Wouldn't this work

Public Class FrameStructure
Public first as string
Public second as string
End Class

Dim myList As New ArrayList
Dim myFrameStructure As New FrameStructure

myFrameStructure.first = "blablabla"
myFrameStructure.second = "bla2bla2bla2"
myList.Add(myFrameStructure)

To use it:

myFrameStructure = ctype(myList(0), FrameStructure)
with myFrameStructure
messagebox.show(.first & vbcrlf & .second)
end with

Am I missing something about strong typing or what?
John

On Thu, 24 Mar 2005 16:57:02 -0800, Dennis
<(E-Mail Removed)> wrote:

>I use the following code for a strongly typed arraylist and it works great.
>However, I was wondering if this is the proper way to do it. I realize that
>if I want to implement sorting of the arraylist then I have to handle this
>with a sort method that uses comparer. I can reference the properties of the
>Arraylist directly such as
>
>dim mylist as new FrameList
>mylist.Add(new FrameStructure)
>mylist(0).first = "blabla..."
>mylist(0).second = "bla2 bla2..."
>
>'Strongly typed arraylist class "FrameList"
>Friend Class FrameList
> Inherits ArrayList
> Default Public Shadows Property Item(ByVal Index As Integer) As
>FrameStructure
> Get
> Return DirectCast(MyBase.Item(Index), FrameStructure)
> End Get
> Set(ByVal Value As FrameStructure)
> MyBase.Item(Index) = Value
> End Set
> End Property
>End Class
>public class FrameStructure
> public first as string
> public second as string
>end class


 
Reply With Quote
 
Cor Ligthert
Guest
Posts: n/a
 
      25th Mar 2005
Dennis,

Why you inherit from Arraylist and not direct from the collectionbase

http://msdn.microsoft.com/library/de...classtopic.asp

A nice sample is included in that page

In my opinion is that simpler and more consistent.

I hope this helps?

Cor


 
Reply With Quote
 
David
Guest
Posts: n/a
 
      25th Mar 2005
On 2005-03-25, J L <(E-Mail Removed)> wrote:
> Hi Dennis,
> I am a .Net newbie so let me ask...why go to the trouble of creating
> the FrameList class? Wouldn't this work


It would work, but...

>
> myFrameStructure = ctype(myList(0), FrameStructure)
> with myFrameStructure
> messagebox.show(.first & vbcrlf & .second)
> end with
>
> Am I missing something about strong typing or what?


Yes, you are. The line

> myFrameStructure = ctype(myList(0), FrameStructure)


isn't strongly typed. If you accidently add something other than a
FrameStructure to myList, you won't know about it until runtime when the
CType fails. A strongly-typed list would prevent me from doing that in
the first place.

Converting runtime errors into compile-time errors is what strong typing
is all about.

 
Reply With Quote
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      25th Mar 2005
"Dennis" <(E-Mail Removed)> schrieb:
>I use the following code for a strongly typed arraylist and it works great.
> However, I was wondering if this is the proper way to do it. I realize
> that
> if I want to implement sorting of the arraylist then I have to handle this
> with a sort method that uses comparer.


You may want to translate the code produced by the collection generator
below to VB.NET:

<URL:http://www.sellsbrothers.com/tools/#collectionGen>

Converting code between .NET programming languages
<URL:http://dotnet.mvps.org/dotnet/faqs/?id=languageconverters&lang=en>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

 
Reply With Quote
 
Jay B. Harlow [MVP - Outlook]
Guest
Posts: n/a
 
      25th Mar 2005
Dennis,
In addition to the other comments, I normally inherit from CollectionBase
when I need a strongly typed arraylist. I normally inherit from
DictionaryBase when I need a strongly typed HashTable.

Something like:

Friend Class FrameList
Inherits CollectionBase

Public Sub Add(ByVal value As FrameStructure)
MyBase.InnerList.Add(value)
End Sub

Default Public Property Item(ByVal Index As Integer) As FrameStructure
Get
Return DirectCast(MyBase.InnerList(Index), FrameStructure)
End Get
Set(ByVal Value As FrameStructure)
MyBase.InnerList(Index) = Value
End Set
End Property

End Class

This allows adding strongly typed methods, such as Add, to the FrameList
also.

Hope this helps
Jay

"Dennis" <(E-Mail Removed)> wrote in message
news:22967A9D-A366-4B18-8B28-(E-Mail Removed)...
>I use the following code for a strongly typed arraylist and it works great.
> However, I was wondering if this is the proper way to do it. I realize
> that
> if I want to implement sorting of the arraylist then I have to handle this
> with a sort method that uses comparer. I can reference the properties of
> the
> Arraylist directly such as
>
> dim mylist as new FrameList
> mylist.Add(new FrameStructure)
> mylist(0).first = "blabla..."
> mylist(0).second = "bla2 bla2..."
>
> 'Strongly typed arraylist class "FrameList"
> Friend Class FrameList
> Inherits ArrayList
> Default Public Shadows Property Item(ByVal Index As Integer) As
> FrameStructure
> Get
> Return DirectCast(MyBase.Item(Index), FrameStructure)
> End Get
> Set(ByVal Value As FrameStructure)
> MyBase.Item(Index) = Value
> End Set
> End Property
> End Class
> public class FrameStructure
> public first as string
> public second as string
> end class
> --
> Dennis in Houston



 
Reply With Quote
 
J L
Guest
Posts: n/a
 
      25th Mar 2005
Hi Jay,
Can you create a strongly typed SortedList also? If so how?

TIA,
John

On Fri, 25 Mar 2005 14:02:15 -0600, "Jay B. Harlow [MVP - Outlook]"
<(E-Mail Removed)> wrote:

>Dennis,
>In addition to the other comments, I normally inherit from CollectionBase
>when I need a strongly typed arraylist. I normally inherit from
>DictionaryBase when I need a strongly typed HashTable.
>
>Something like:
>
>Friend Class FrameList
> Inherits CollectionBase
>
> Public Sub Add(ByVal value As FrameStructure)
> MyBase.InnerList.Add(value)
> End Sub
>
> Default Public Property Item(ByVal Index As Integer) As FrameStructure
> Get
> Return DirectCast(MyBase.InnerList(Index), FrameStructure)
> End Get
> Set(ByVal Value As FrameStructure)
> MyBase.InnerList(Index) = Value
> End Set
> End Property
>
>End Class
>
>This allows adding strongly typed methods, such as Add, to the FrameList
>also.
>
>Hope this helps
>Jay
>
>"Dennis" <(E-Mail Removed)> wrote in message
>news:22967A9D-A366-4B18-8B28-(E-Mail Removed)...
>>I use the following code for a strongly typed arraylist and it works great.
>> However, I was wondering if this is the proper way to do it. I realize
>> that
>> if I want to implement sorting of the arraylist then I have to handle this
>> with a sort method that uses comparer. I can reference the properties of
>> the
>> Arraylist directly such as
>>
>> dim mylist as new FrameList
>> mylist.Add(new FrameStructure)
>> mylist(0).first = "blabla..."
>> mylist(0).second = "bla2 bla2..."
>>
>> 'Strongly typed arraylist class "FrameList"
>> Friend Class FrameList
>> Inherits ArrayList
>> Default Public Shadows Property Item(ByVal Index As Integer) As
>> FrameStructure
>> Get
>> Return DirectCast(MyBase.Item(Index), FrameStructure)
>> End Get
>> Set(ByVal Value As FrameStructure)
>> MyBase.Item(Index) = Value
>> End Set
>> End Property
>> End Class
>> public class FrameStructure
>> public first as string
>> public second as string
>> end class
>> --
>> Dennis in Houston

>


 
Reply With Quote
 
Jay B. Harlow [MVP - Outlook]
Guest
Posts: n/a
 
      25th Mar 2005
John,
The following was originally posted by me 23 August 2003 under the
"ArrayList ToArray issues" thread in this newsgroup.

Attached are extended CollectionBase & DictonaryBase classes, that should do
what you want.

I wrote them to mimic CollectionBase & DictionaryBase as close as possible.
The differences being is they have a constructor that you can pass the inner
container to the constructor. And the InnerList changed to an IList type,
while InnerHashtable changed to InnerDictionary of type IDictionary.

CollectionBaseEx accepts an IList in the constructor, if you do not give
one, ArrayList is used. For example you could pass an array of objects,
making a fixed size list, instead of an ArrayList. InnerList does not do
validation, List does validation.

DictionaryBaseEx accepts an IDictionary in the constructor, if you do not
give one, HashTable is used. For example you can pass SortedList,
HybridDictionary, ListDictionary, instead of a HashTable. InnerDictionary
does not do validation, Dictionary does validation.

You can derive from DictionaryBaseEx then pass a new SortedList to the
constructor.

Something like:
Public Class FrameSortedList
Inherits ExDictionaryBase

Public Sub New()
MyBase.New(New SortedList)
End Sub

' other methods you want

End Class

FWIW: I actually started with the m_dictionary field in DictionaryBaseEx as
type SortedList, but then noticed I did not rely on it specifically being a
SortedList, so I modified DictionaryBaseEx to support any IDictionary,
which IMHO actually makes the class far more flexible.

If you use them, let me know if you find any problems with them.

Hope this helps
Jay

---x--- Begin DictionaryBaseEx.vb ---x---
<Serializable()> _
Public MustInherit Class DictionaryBaseEx
Implements IDictionary

Private ReadOnly m_dictionary As IDictionary

Protected Sub New()
MyClass.New(New Hashtable)
End Sub

Protected Sub New(ByVal dictionary As IDictionary)
If dictionary Is Nothing Then
Throw New ArgumentNullException("dictionary")
End If
m_dictionary = dictionary
End Sub

Protected ReadOnly Property InnerDictionary() As IDictionary
Get
Return m_dictionary
End Get
End Property

Protected ReadOnly Property Dictionary() As IDictionary
Get
Return Me
End Get
End Property

Public ReadOnly Property Count() As Integer Implements ICollection.Count
Get
Return m_dictionary.Count
End Get
End Property

Public Sub Clear() Implements IDictionary.Clear
Me.OnClear()
m_dictionary.Clear()
Me.OnClearComplete()
End Sub

Public Sub CopyTo(ByVal array As System.Array, ByVal index As Integer)
Implements ICollection.CopyTo
m_dictionary.CopyTo(array, index)
End Sub

Public Function GetEnumerator() As IDictionaryEnumerator Implements
IDictionary.GetEnumerator
Return m_dictionary.GetEnumerator
End Function

#Region " IDictionary support "

Private ReadOnly Property IDictionary_IsSynchronized() As Boolean
Implements ICollection.IsSynchronized
Get
Return m_dictionary.IsSynchronized
End Get
End Property

Private ReadOnly Property IDictionary_SyncRoot() As Object Implements
ICollection.SyncRoot
Get
Return m_dictionary.SyncRoot
End Get
End Property

Private Function IEnumerable_GetEnumerator() As IEnumerator Implements
IEnumerable.GetEnumerator
Return m_dictionary.GetEnumerator()
End Function

Private Sub IDictionary_Add(ByVal key As Object, ByVal value As Object)
Implements IDictionary.Add
Me.OnValidate(key, value)
Me.OnInsert(key, value)
m_dictionary.Add(key, value)
Me.OnInsertComplete(key, value)
End Sub

Private Function IDictionary_Contains(ByVal key As Object) As Boolean
Implements IDictionary.Contains
Return m_dictionary.Contains(key)
End Function

Private ReadOnly Property IDictionary_IsFixedSize() As Boolean
Implements IDictionary.IsFixedSize
Get
Return m_dictionary.IsFixedSize
End Get
End Property

Private ReadOnly Property IDictionary_IsReadOnly() As Boolean Implements
IDictionary.IsReadOnly
Get
Return m_dictionary.IsReadOnly
End Get
End Property

Private Property IDictionary_Item(ByVal key As Object) As Object
Implements IDictionary.Item
Get
Dim currentValue As Object = m_dictionary.Item(key)
currentValue = Me.OnGet(key, currentValue)
Return currentValue
End Get
Set(ByVal value As Object)
Dim oldValue As Object = m_dictionary.Item(key)
Me.OnValidate(key, value)
Me.OnSet(key, oldValue, value)
m_dictionary.Item(key) = value
Me.OnSetComplete(key, oldValue, value)
End Set
End Property

Private ReadOnly Property IDictionary_Keys() As ICollection Implements
IDictionary.Keys
Get
Return m_dictionary.Keys
End Get
End Property

Private Sub IDictionary_Remove(ByVal key As Object) Implements
IDictionary.Remove
Dim value As Object = m_dictionary.Item(key)
Me.OnValidate(key, value)
Me.OnRemove(key, value)
m_dictionary.Remove(key)
Me.OnRemoveComplete(key, value)
End Sub

Private ReadOnly Property IDictionary_Values() As ICollection Implements
IDictionary.Values
Get
Return m_dictionary.Values
End Get
End Property

#End Region

#Region " Custom processing support "

Protected Overridable Sub OnClear()

End Sub

Protected Overridable Sub OnClearComplete()

End Sub

Protected Overridable Function OnGet(ByVal key As Object, ByVal
currentValue As Object) As Object
Return currentValue
End Function

Protected Overridable Sub OnInsert(ByVal key As Object, ByVal value As
Object)

End Sub

Protected Overridable Sub OnInsertComplete(ByVal key As Object, ByVal
value As Object)

End Sub

Protected Overridable Sub OnRemove(ByVal key As Object, ByVal value As
Object)

End Sub

Protected Overridable Sub OnRemoveComplete(ByVal key As Object, ByVal
value As Object)

End Sub

Protected Overridable Sub OnSet(ByVal key As Object, ByVal oldValue As
Object, ByVal newValue As Object)

End Sub

Protected Overridable Sub OnSetComplete(ByVal key As Object, ByVal
oldValue As Object, ByVal newValue As Object)

End Sub

Protected Overridable Sub OnValidate(ByVal key As Object, ByVal value As
Object)

End Sub

#End Region

End Class
---x--- End DictionaryBaseEx.vb ---x---

---x--- Begin CollectionBaseEx.vb ---x---

<Serializable()> _
Public MustInherit Class CollectionBaseEx
Implements IList

Private ReadOnly m_list As IList

Protected Sub New()
MyClass.New(New ArrayList)
End Sub

Protected Sub New(ByVal list As IList)
If list Is Nothing Then
Throw New ArgumentNullException("list")
End If
m_list = list
End Sub

Protected ReadOnly Property InnerList() As IList
Get
Return m_list
End Get
End Property

Protected ReadOnly Property List() As IList
Get
Return Me
End Get
End Property

Public ReadOnly Property Count() As Integer Implements ICollection.Count
Get
Return m_list.Count
End Get
End Property

Public Sub Clear() Implements IList.Clear
Me.OnClear()
m_list.Clear()
Me.OnClearComplete()
End Sub

Public Function GetEnumerator() As IEnumerator Implements
IList.GetEnumerator
Return m_list.GetEnumerator
End Function

Public Sub RemoveAt(ByVal index As Integer) Implements IList.RemoveAt
Dim value As Object = m_list(index)
Me.OnValidate(value)
Me.OnRemove(index, value)
m_list.RemoveAt(index)
Me.OnRemoveComplete(index, value)
End Sub

#Region " IList support "

Private ReadOnly Property IList_IsSynchronized() As Boolean Implements
ICollection.IsSynchronized
Get
Return m_list.IsSynchronized
End Get
End Property

Private ReadOnly Property IList_SyncRoot() As Object Implements
ICollection.SyncRoot
Get
Return m_list.SyncRoot
End Get
End Property

Private ReadOnly Property IList_IsFixedSize() As Boolean Implements
IList.IsFixedSize
Get
Return m_list.IsFixedSize
End Get
End Property

Private ReadOnly Property IList_IsReadOnly() As Boolean Implements
IList.IsReadOnly
Get
Return m_list.IsReadOnly
End Get
End Property

Private Function IList_Add(ByVal value As Object) As Integer Implements
IList.Add
Dim index As Integer = m_list.Count
Me.OnValidate(value)
Me.OnInsert(index, value)
Return m_list.Add(value)
Me.OnInsertComplete(index, value)
End Function

Private Sub IList_CopyTo(ByVal array As System.Array, ByVal index As
Integer) Implements ICollection.CopyTo
m_list.CopyTo(array, index)
End Sub

Private Function IList_Contains(ByVal value As Object) As Boolean
Implements IList.Contains
Return m_list.Contains(value)
End Function

Private Function IList_IndexOf(ByVal value As Object) As Integer
Implements IList.IndexOf
Return m_list.IndexOf(value)
End Function

Private Sub IList_Insert(ByVal index As Integer, ByVal value As Object)
Implements IList.Insert
Me.OnValidate(value)
Me.OnInsert(index, value)
m_list.Insert(index, value)
Me.OnInsertComplete(index, value)
End Sub

Private Property IList_Item(ByVal index As Integer) As Object Implements
IList.Item
Get
Dim currentValue As Object = m_list.Item(index)
currentValue = Me.OnGet(index, currentValue)
Return currentValue
End Get
Set(ByVal value As Object)
Dim oldValue As Object = m_list(index)
Me.OnValidate(value)
Me.OnSet(index, oldValue, value)
m_list(index) = value
Me.OnSetComplete(index, oldValue, value)
End Set
End Property

Private Sub IList_Remove(ByVal value As Object) Implements IList.Remove
Dim index As Integer = m_list.IndexOf(value)
Me.OnValidate(value)
Me.OnRemove(index, value)
m_list.Remove(value)
Me.OnRemoveComplete(index, value)
End Sub

#End Region

#Region " Custom processing support "

Protected Overridable Sub OnClear()

End Sub

Protected Overridable Sub OnClearComplete()

End Sub

Protected Overridable Function OnGet(ByVal index As Integer, ByVal
currentValue As Object) As Object
Return currentValue
End Function

Protected Overridable Sub OnInsert(ByVal index As Integer, ByVal value
As Object)

End Sub

Protected Overridable Sub OnInsertComplete(ByVal index As Integer, ByVal
value As Object)

End Sub

Protected Overridable Sub OnRemove(ByVal index As Integer, ByVal value
As Object)

End Sub

Protected Overridable Sub OnRemoveComplete(ByVal index As Integer, ByVal
value As Object)

End Sub

Protected Overridable Sub OnSet(ByVal index As Integer, ByVal oldValue
As Object, ByVal newValue As Object)

End Sub

Protected Overridable Sub OnSetComplete(ByVal index As Integer, ByVal
oldValue As Object, ByVal newValue As Object)

End Sub

Protected Overridable Sub OnValidate(ByVal value As Object)

End Sub

#End Region

End Class
---x--- End CollectionBaseEx.vb ---x---


"J L" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi Jay,
> Can you create a strongly typed SortedList also? If so how?
>
> TIA,
> John
>
> On Fri, 25 Mar 2005 14:02:15 -0600, "Jay B. Harlow [MVP - Outlook]"
> <(E-Mail Removed)> wrote:
>
>>Dennis,
>>In addition to the other comments, I normally inherit from CollectionBase
>>when I need a strongly typed arraylist. I normally inherit from
>>DictionaryBase when I need a strongly typed HashTable.
>>
>>Something like:
>>
>>Friend Class FrameList
>> Inherits CollectionBase
>>
>> Public Sub Add(ByVal value As FrameStructure)
>> MyBase.InnerList.Add(value)
>> End Sub
>>
>> Default Public Property Item(ByVal Index As Integer) As FrameStructure
>> Get
>> Return DirectCast(MyBase.InnerList(Index), FrameStructure)
>> End Get
>> Set(ByVal Value As FrameStructure)
>> MyBase.InnerList(Index) = Value
>> End Set
>> End Property
>>
>>End Class
>>
>>This allows adding strongly typed methods, such as Add, to the FrameList
>>also.
>>
>>Hope this helps
>>Jay
>>
>>"Dennis" <(E-Mail Removed)> wrote in message
>>news:22967A9D-A366-4B18-8B28-(E-Mail Removed)...
>>>I use the following code for a strongly typed arraylist and it works
>>>great.
>>> However, I was wondering if this is the proper way to do it. I realize
>>> that
>>> if I want to implement sorting of the arraylist then I have to handle
>>> this
>>> with a sort method that uses comparer. I can reference the properties
>>> of
>>> the
>>> Arraylist directly such as
>>>
>>> dim mylist as new FrameList
>>> mylist.Add(new FrameStructure)
>>> mylist(0).first = "blabla..."
>>> mylist(0).second = "bla2 bla2..."
>>>
>>> 'Strongly typed arraylist class "FrameList"
>>> Friend Class FrameList
>>> Inherits ArrayList
>>> Default Public Shadows Property Item(ByVal Index As Integer) As
>>> FrameStructure
>>> Get
>>> Return DirectCast(MyBase.Item(Index), FrameStructure)
>>> End Get
>>> Set(ByVal Value As FrameStructure)
>>> MyBase.Item(Index) = Value
>>> End Set
>>> End Property
>>> End Class
>>> public class FrameStructure
>>> public first as string
>>> public second as string
>>> end class
>>> --
>>> Dennis in Houston

>>

>



 
Reply With Quote
 
=?Utf-8?B?RGVubmlz?=
Guest
Posts: n/a
 
      25th Mar 2005
I guess the primary reason that I inheirt from the arraylist is the sort
property. In my real application, I make extensive use of the ArrayList Sort
property in my strongly typed arraylist class using Icomparer. What is the
advantage of using the collectionbase over the arraylist?

"Cor Ligthert" wrote:

> Dennis,
>
> Why you inherit from Arraylist and not direct from the collectionbase
>
> http://msdn.microsoft.com/library/de...classtopic.asp
>
> A nice sample is included in that page
>
> In my opinion is that simpler and more consistent.
>
> I hope this helps?
>
> Cor
>
>
>

 
Reply With Quote
 
=?Utf-8?B?RGVubmlz?=
Guest
Posts: n/a
 
      25th Mar 2005
I make extensive use of the ArrayList Sort property using Icomparer in my
real application and I didn't find that the collectionbase has this property.
What's the real advantage of using collectionbase as opposed to inheriting
from an arraylist?

"Jay B. Harlow [MVP - Outlook]" wrote:

> Dennis,
> In addition to the other comments, I normally inherit from CollectionBase
> when I need a strongly typed arraylist. I normally inherit from
> DictionaryBase when I need a strongly typed HashTable.
>
> Something like:
>
> Friend Class FrameList
> Inherits CollectionBase
>
> Public Sub Add(ByVal value As FrameStructure)
> MyBase.InnerList.Add(value)
> End Sub
>
> Default Public Property Item(ByVal Index As Integer) As FrameStructure
> Get
> Return DirectCast(MyBase.InnerList(Index), FrameStructure)
> End Get
> Set(ByVal Value As FrameStructure)
> MyBase.InnerList(Index) = Value
> End Set
> End Property
>
> End Class
>
> This allows adding strongly typed methods, such as Add, to the FrameList
> also.
>
> Hope this helps
> Jay
>
> "Dennis" <(E-Mail Removed)> wrote in message
> news:22967A9D-A366-4B18-8B28-(E-Mail Removed)...
> >I use the following code for a strongly typed arraylist and it works great.
> > However, I was wondering if this is the proper way to do it. I realize
> > that
> > if I want to implement sorting of the arraylist then I have to handle this
> > with a sort method that uses comparer. I can reference the properties of
> > the
> > Arraylist directly such as
> >
> > dim mylist as new FrameList
> > mylist.Add(new FrameStructure)
> > mylist(0).first = "blabla..."
> > mylist(0).second = "bla2 bla2..."
> >
> > 'Strongly typed arraylist class "FrameList"
> > Friend Class FrameList
> > Inherits ArrayList
> > Default Public Shadows Property Item(ByVal Index As Integer) As
> > FrameStructure
> > Get
> > Return DirectCast(MyBase.Item(Index), FrameStructure)
> > End Get
> > Set(ByVal Value As FrameStructure)
> > MyBase.Item(Index) = Value
> > End Set
> > End Property
> > End Class
> > public class FrameStructure
> > public first as string
> > public second as string
> > end class
> > --
> > Dennis in Houston

>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
what is meant by typed/untyped/strongly typed datasets? Rachana Microsoft VB .NET 4 14th Nov 2007 07:11 PM
ArrayList - Strongly Typed =?Utf-8?B?RGVubmlz?= Microsoft VB .NET 5 2nd Oct 2004 09:07 PM
Strongly typed arraylist and inheritance issue Dot net work Microsoft C# .NET 4 29th Aug 2004 01:17 PM
strongly typed Mark Microsoft C# .NET 2 10th Sep 2003 01:39 PM
OO Design Question - Strongly typed ArrayList Bill Cohagan Microsoft Dot NET 4 2nd Jul 2003 01:27 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:42 PM.