L
lpinho
Hi all,
I have a class (named for the example myObject) that can be of
several types (int, string, float, etc), instead of using a object to
define it's type I used a generic.
public class MyObject<T> : ChangeObject
{
...
public MyObject(string name, T value)
{
// invoke the properties, since there's additional work to
do
Name = name;
Value = value;
}
}
Until now, everything is ok, what I want to do now, is to set a
property inside a class that is a list of these objects.
So I thought it would be has easy has:
List<MyObject<T>> Objects;
or even:
MyObject<T>[] Objects;
But it seems that the T only works on class definitions, is this
true?
What can I do to have a list of generic objects of this kind?
Thanks
I have a class (named for the example myObject) that can be of
several types (int, string, float, etc), instead of using a object to
define it's type I used a generic.
public class MyObject<T> : ChangeObject
{
...
public MyObject(string name, T value)
{
// invoke the properties, since there's additional work to
do
Name = name;
Value = value;
}
}
Until now, everything is ok, what I want to do now, is to set a
property inside a class that is a list of these objects.
So I thought it would be has easy has:
List<MyObject<T>> Objects;
or even:
MyObject<T>[] Objects;
But it seems that the T only works on class definitions, is this
true?
What can I do to have a list of generic objects of this kind?
Thanks