G
Guest
I am trying to follow along with an example about how to create a generic
collection which is "Type" drivern (the article is here
http://www.ftponline.com/vsm/2007_02/magazine/features/dfergus/page4.aspx - I
think you have to have an account to actually see the article...but anyway).
In the example, they declare a couple arraylist. When I attempt to create a
new instance of the class, I get a null exception on the array list which
were declared. In looking at the example further, I do not see where there
is a constructor for the class. In the example, there is code for VB and
then code for C#. In VB, I believe the example show a constructor which
looks like the following:
Public Sub New()
_deletedList = New ArrayList(5)
_addedList = New ArrayList(5)
End Sub
The example shows no constructor for C#, so I guessing it was just omitted
in error. I am trying to figure out the constructor (shouldn't be
difficult), but I can't figure it out. He is a sample of my generic class..
public class CollectionEx<T> : System.Collections.CollectionBase
where T : ICollectionEx
{
}
If I try to add a construtor which looks like the following, I get an
error....
public CollectionEx<T>()
{
_DeletedList = new ArrayList();
}
What am I missing?
collection which is "Type" drivern (the article is here
http://www.ftponline.com/vsm/2007_02/magazine/features/dfergus/page4.aspx - I
think you have to have an account to actually see the article...but anyway).
In the example, they declare a couple arraylist. When I attempt to create a
new instance of the class, I get a null exception on the array list which
were declared. In looking at the example further, I do not see where there
is a constructor for the class. In the example, there is code for VB and
then code for C#. In VB, I believe the example show a constructor which
looks like the following:
Public Sub New()
_deletedList = New ArrayList(5)
_addedList = New ArrayList(5)
End Sub
The example shows no constructor for C#, so I guessing it was just omitted
in error. I am trying to figure out the constructor (shouldn't be
difficult), but I can't figure it out. He is a sample of my generic class..
public class CollectionEx<T> : System.Collections.CollectionBase
where T : ICollectionEx
{
}
If I try to add a construtor which looks like the following, I get an
error....
public CollectionEx<T>()
{
_DeletedList = new ArrayList();
}
What am I missing?