Collection Classes

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Kevin Phifer

    #1

    Collection Classes

    I'm converting over to .net via c# from vb6. There was
    this great article called the house of bricks that showed
    you how to create a strongly typed collection class.
    In .net I have found the CollectionBase and DictionaryBase
    that I can create these from, but I also noted that I can
    support the IEnum's as well using something like an
    ArrayList to store the data.

    What I would like to know is, is there another article out
    there like House of Bricks that can give me the pitfalls
    of which way to create strongly typed collection type
    classes?

    or what is the "best" way to do this.

    Thanx in advance....
  • Miha Markic

    #2
    Re: Collection Classes

    Hi Kevin,

    You might check (free) CodeSmith tool that does it and much much more..


    --
    Miha Markic - RightHand .NET consulting & software development
    miha at rthand com

    "Kevin Phifer" <kevin@nospam.p lumcon.com> wrote in message
    news:019301c3ad 80$727bc900$a40 1280a@phx.gbl.. .[color=blue]
    > I'm converting over to .net via c# from vb6. There was
    > this great article called the house of bricks that showed
    > you how to create a strongly typed collection class.
    > In .net I have found the CollectionBase and DictionaryBase
    > that I can create these from, but I also noted that I can
    > support the IEnum's as well using something like an
    > ArrayList to store the data.
    >
    > What I would like to know is, is there another article out
    > there like House of Bricks that can give me the pitfalls
    > of which way to create strongly typed collection type
    > classes?
    >
    > or what is the "best" way to do this.
    >
    > Thanx in advance....[/color]


    Comment

    • Miha Markic

      #3
      Re: Collection Classes

      Hi Kevin,

      You might check (free) CodeSmith tool that does it and much much more..


      --
      Miha Markic - RightHand .NET consulting & software development
      miha at rthand com

      "Kevin Phifer" <kevin@nospam.p lumcon.com> wrote in message
      news:019301c3ad 80$727bc900$a40 1280a@phx.gbl.. .[color=blue]
      > I'm converting over to .net via c# from vb6. There was
      > this great article called the house of bricks that showed
      > you how to create a strongly typed collection class.
      > In .net I have found the CollectionBase and DictionaryBase
      > that I can create these from, but I also noted that I can
      > support the IEnum's as well using something like an
      > ArrayList to store the data.
      >
      > What I would like to know is, is there another article out
      > there like House of Bricks that can give me the pitfalls
      > of which way to create strongly typed collection type
      > classes?
      >
      > or what is the "best" way to do this.
      >
      > Thanx in advance....[/color]


      Comment

      • Michael Lang

        #4
        Re: Collection Classes

        "Kevin Phifer" <kevin@nospam.p lumcon.com> wrote in news:019301c3ad 80
        $727bc900$a4012 80a@phx.gbl:
        [color=blue]
        > I'm converting over to .net via c# from vb6. There was
        > this great article called the house of bricks that showed
        > you how to create a strongly typed collection class.
        > In .net I have found the CollectionBase and DictionaryBase
        > that I can create these from, but I also noted that I can
        > support the IEnum's as well using something like an
        > ArrayList to store the data.
        >
        > What I would like to know is, is there another article out
        > there like House of Bricks that can give me the pitfalls
        > of which way to create strongly typed collection type
        > classes?
        >
        > or what is the "best" way to do this.[/color]

        I've created a simple collection generator and some templates. Each has
        a short description of their purpose...

        http://sourceforge.net/projects/colcodegen

        One of them inherits from CollectionBase and implements IDictionary.
        Know that CollectionBase already implements IEnumerable, IList, and
        ICollection.

        IList is a really important one if you want your collection to be
        bindable to a DataGrid.

        Also here is an article that creates a new collection type implementing
        IDictionary and IEnumerable only:



        Overall, for replicating the VB6 collection just inherit from
        CollectionBase and add an internal HashTable for storing by key in
        addition to by index (CollectionBase ). THe templates on my open source
        project site do this.

        Michael Lang, MCSD

        Comment

        • Michael Lang

          #5
          Re: Collection Classes

          "Kevin Phifer" <kevin@nospam.p lumcon.com> wrote in news:019301c3ad 80
          $727bc900$a4012 80a@phx.gbl:
          [color=blue]
          > I'm converting over to .net via c# from vb6. There was
          > this great article called the house of bricks that showed
          > you how to create a strongly typed collection class.
          > In .net I have found the CollectionBase and DictionaryBase
          > that I can create these from, but I also noted that I can
          > support the IEnum's as well using something like an
          > ArrayList to store the data.
          >
          > What I would like to know is, is there another article out
          > there like House of Bricks that can give me the pitfalls
          > of which way to create strongly typed collection type
          > classes?
          >
          > or what is the "best" way to do this.[/color]

          I've created a simple collection generator and some templates. Each has
          a short description of their purpose...

          http://sourceforge.net/projects/colcodegen

          One of them inherits from CollectionBase and implements IDictionary.
          Know that CollectionBase already implements IEnumerable, IList, and
          ICollection.

          IList is a really important one if you want your collection to be
          bindable to a DataGrid.

          Also here is an article that creates a new collection type implementing
          IDictionary and IEnumerable only:



          Overall, for replicating the VB6 collection just inherit from
          CollectionBase and add an internal HashTable for storing by key in
          addition to by index (CollectionBase ). THe templates on my open source
          project site do this.

          Michael Lang, MCSD

          Comment

          Working...