Re: Collection of Generic Objects
- From: "Lloyd Dupont" <net.galador@ld>
- Date: Fri, 2 Dec 2005 11:38:03 +1000
> In other words, what you're describing is not possible.
that's right.
however if you just look for a collection and are not aware of your options,
you could use:
System.Collection.ArrayList
or
System.Collection.Generic.List<object>
>
> --
> HTH,
>
> Kevin Spencer
> Microsoft MVP
> .Net Developer
> If you push something hard enough,
> it will fall over.
> - Fudd's First Law of Opposition
>
> "msnews.microsoft.com" <goot@xxxxxxxxxxxxxxxxxx> wrote in message
> news:ObkhpYt9FHA.2640@xxxxxxxxxxxxxxxxxxxxxxx
>>I got (what I hope to be is) a simple question....
>>
>> I have a class called PropertyObject<T>
>>
>> so in my code I created something like this..
>>
>> name = new PropertyObject<string>("goot");
>> age = new PropertyObject<int>(20);
>>
>> but what I would rather do is this
>>
>> List<PropertyObject<T>> props = new List<PropertyObject>();
>> props.Add(new PropertyObject<string>("goot"));
>> props.Add(new PropertyObject<int>(20));
>>
>> where the List<> props can only contain PropertyObject<T>'s of any T
>>
>> Is this posible or does List<> have to contain only PropertyObjects of
>> the same generic type parameter and in which case I have to use an
>> ArrayList?
>>
>
>
.
- References:
- Collection of Generic Objects
- From: msnews.microsoft.com
- Re: Collection of Generic Objects
- From: Kevin Spencer
- Collection of Generic Objects
- Prev by Date: Re: Collection of Generic Objects
- Next by Date: DllImportAttribute
- Previous by thread: Re: Collection of Generic Objects
- Next by thread: Re: Collection of Generic Objects
- Index(es):
Relevant Pages
|