Creating String Collection

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Haim Turjeman

    #1

    Creating String Collection

    i want to create a dynamic collection of strings.
    the way i know to do this is with ArrayList

    class stringCol
    {
    ArrayList string = new ArrayList();

    public string this[int i]
    { get{ return (string)strings[i]; }
    set...
    }
    ...
    }
    (this is only an example of the code)

    i want to avoid the casting part!!
    how do i do it?
    maybe IList / ICollection , i don't know.

    it will be very helpfull if you refer me to a good source on the subject
    or explain it yourself

    thanx ahead!

  • Fred Heida

    #2
    Re: Creating String Collection

    try System.Collecti ons.Specialized .StringCollecti on

    Regards,

    Fred


    "Haim Turjeman" <beber@bezeqint .net> wrote in message
    news:upe2iCxTDH A.2512@TK2MSFTN GP10.phx.gbl...[color=blue]
    > i want to create a dynamic collection of strings.
    > the way i know to do this is with ArrayList
    >
    > class stringCol
    > {
    > ArrayList string = new ArrayList();
    >
    > public string this[int i]
    > { get{ return (string)strings[i]; }
    > set...
    > }
    > ...
    > }
    > (this is only an example of the code)
    >
    > i want to avoid the casting part!!
    > how do i do it?
    > maybe IList / ICollection , i don't know.
    >
    > it will be very helpfull if you refer me to a good source on the subject
    > or explain it yourself
    >
    > thanx ahead!
    >[/color]


    Comment

    Working...