RE: declaration of objects in a ArrayList , C#



Hello,
Try to use
public List<CAdresses> adresses = new List<CAdresses>();

But this only works in C# 2.0. In 1.1. you have to cast ArrayList members to
class you need.

Best regards,
Andrew

"Jens Stjärna" wrote:

> 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

  • declaration of objects in a ArrayList , C#
    ... 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 ... intellisense. ... Best regards, Jens ...
    (microsoft.public.dotnet.general)
  • Re: Seeting malloc pointer to NULL [2] -Totally confused!!!!!
    ... Best regards ... So now that I have gotten it to work in the VC++ compiler, ... mayby my compiler doesn't support pointers to pointers! ... from void* to other pointer types. ...
    (microsoft.public.vc.language)
  • Re: instantiation point discussion
    ... Or buy the full compiler. ... code to a cpp file, compile it with /FAsc, and look at the resulting .cod ... Tim Roberts, timr@xxxxxxxxx ...
    (microsoft.public.vc.language)
  • Re: HOF implementation of "until"
    ... >> Case expressions themselves may be regarded as syntactic sugar ... While it is clear that standard compiler techniques should be able to do ... quite a bit of optimization on the post-macro-expanded object code, ... Regards ...
    (comp.lang.functional)
  • Re: writing text to a file...
    ... > a newer compiler in the first place. ... I would do that but i dont have many for oryginal versions;> ... Best Regards, ... Wodzu ...
    (comp.lang.cpp)