VentureFree
Well-known member
- Joined
- Jan 9, 2008
- Messages
- 54
- Programming Experience
- 5-10
Array access in a collection
I'm converting a library from C# to VB.net which so far hasn't been too difficult. One class though implements IEnumerable and IEnumerator and contains a block of code like this:
This is obviously what allows me to access individual elements within the collection by simply appending the [] brackets to the variable name instead of having to expose _objMyClassList through a property or using a function.
I'm not sure how to do the same thing in VB. So...um...how do you do that in VB.net?
I'm converting a library from C# to VB.net which so far hasn't been too difficult. One class though implements IEnumerable and IEnumerator and contains a block of code like this:
VB.NET:
public class MyClassCollection
{
// Assume all other necessary code is in place
protected ArrayList _objMyClassList = new ArrayList();
public MyClass this[int index]
{
get { return (MyClass)_objMyClassList[index]; }
set { _objMyClassList[index] = (object)value; }
}
}
I'm not sure how to do the same thing in VB. So...um...how do you do that in VB.net?