3
Reply

Which Class to create for a collection

Scott Stewart

Scott Stewart

Feb 13 2012 2:12 PM
1.2k
I read the article at MSDN (http://msdn.microsoft.com/en-us/library/6tc79sx1.aspx) about selecting a collection class, but I don't understand any better. I am converting a VBA Access program to C#. I have a class that represents a document and the various parts of a document. I want to be able to add each document to a collection. In VBA it was difficult because you had to create a unique ID for each instance and then add it to the collection. So I created a class and the parameters. Do I have to create a unique ID for the collection? I want to be able to sort the members of the collection by a date. I want to be able to do a "For each" type of operation on the collection. There should not be a lot of work in the class since it is just an instrument that will eventually be put back into the database.
I am using "using System.Collections.Generic" with parameters such as public string Volume {get; set;}.
Be gentle with me. I have never used C# before! I have read a lot of stuff, but I still need some guidance.
Visual Studio Professional 10, Windows 7.
If you think I am going about this the wrong way please ask questions so I can better explain myself.

Thanks for the input!

Scott

Answers (3)