declaration of objects in a ArrayList , C#

Tech-Archive recommends: Fix windows errors by optimizing your registry



Hi.
I have a question regarding the ArrayList.
In my code I use the arraylist to store objects of certain class.
I do not mix object types in the same ArrayList.

public ArrayList adresses = new ArrayList();

I store only objects from the class "CAdresses" in this ArrayList.
Now, every time I use the objects in the ArrayList I have to type cast them
into aCAdresses class type object since the compiler only knows it is a
object.
I want to declare the ArrayList so that it is known to the compiler which
type is stored in there so that I do not need the bulky syntax, and can use
intellisense.

Best regards, Jens
.



Relevant Pages

  • RE: declaration of objects in a ArrayList , C#
    ... you have to cast ArrayList members to ... > In my code I use the arraylist to store objects of certain class. ... > I want to declare the ArrayList so that it is known to the compiler which ... > Best regards, Jens ...
    (microsoft.public.dotnet.general)
  • Struct of Class
    ... to store objects? ... Regards ... Simon. ... Prev by Date: ...
    (microsoft.public.dotnet.languages.csharp)