All you need is to use
List<t>[
^] generic class, which represents a strongly typed list of objects that can be accessed by index and provides methods to search, sort, and manipulate lists.
But before you start programming, you need to correct your class to store correct types of values:
class Child
{
private string sname = string.Empty;
private string sblood = string.Empty;
private DateTime dbirth = DateTime.MinValue;
public Child(string childname, string childblood, DateTime childdbirth )
{
sname = childname;
sblood = childblood;
dbirth = childdbirth;
}
public DateTime Childbirth
{
get { return dbirth; }
set { dbirth = value; }
}
public string Childblood
{
get { return sblood; }
set { sblood = value; }
}
public string Childname
{
get { return sname; }
set { sname = value; }
}
}
Usage:
List<child> oLstChilds = new List<child>();
Child oChild1 = new Child("Adam", "A Rh+", new DateTime(2013, 1, 5));
oLstChilds.Add(oChild1);
Child oChild2 = new Child("Julia", "B Rh+", new DateTime(2013, 2, 7));
oLstChilds.Add(oChild2);
Child oChild3 = new Child("Carlo", "0 Rh-", new DateTime(2013, 3, 9));
oLstChilds.Add(oChild3);
Child oChild4 = new Child("Maciej", "0 Rh+", new DateTime(2013, 4, 11));
oLstChilds.Add(oChild4);
MessageBox.Show (string.Format("Count of Childs: {0}", oLstChilds.Count));</child></child>