Re: Collection of Generic Objects

Tech-Archive recommends: Speed Up your PC by fixing your registry



> 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?
>>
>
>


.



Relevant Pages

  • Re: Great group!(Paul)
    ... Fudd's First Law of Opposition: If you push something hard enough, ...
    (rec.arts.comics.dc.universe)
  • Re: Quick crisis question
    ... >>>World War II, but not for Vietnam or Korea is just that, junk. ... >> Fudd's First Law of Opposition: If you push something hard enough, ...
    (rec.arts.comics.dc.universe)
  • Re: Barry Allen alive
    ... Fudd's First Law of Opposition: If you push something hard enough, ... Prev by Date: ...
    (rec.arts.comics.dc.universe)
  • Re: Parsing percentage % to double
    ... ..Net Developer ... If you push something hard enough, ... - Fudd's First Law of Opposition ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Can We Stop The Time?
    ... move freely in a three-dimensional space but we must exert a force. ... According to Newton's first law we will continue in its state of rest ... resultant force exerting on the time may be zero. ... when you push against a wall, that is what we call a force, ...
    (sci.physics.relativity)