First create an object to represent the "Person":
internal sealed class Person{
private string socialSecurityNumber;
private string name;
private string address;
private bool isAlive;
public Person(string ssNum, string theName, string theAddress, bool aliveStatus){
this.socialSecurityNumber = ssNum;
this.name = theName;
this.address = theAddress;
this.isAlive = aliveStatus;
}
public string Name{
get{ return this.name; }
}
public string Address{
get{ return this.address; }
}
public string SocialSecurityNumber{
get{ return this.socialSecurityNumber; }
}
public bool IsAlive{
get{ return this.isAlive; }
}
}
*********************************************
The next step is to create however many person object instances as you need, and store each in a hashtable using the social security number as the unique identifier (IE Key).
public sealed class DemoClass{
private Person person;
private Hashtable table = new Hashtable();
public DemoClass(){}
public void CreateUser(string name, string address, string socialSecurityNumber, bool isAlive){
person = new Person(name,address,socialSecurityNumber, isAlive);
this.table.Add(person.SocialSecurityNumber,person);
}
public Person GetPerson(string socialSecurityNumber){
if(!table.Contains(socialSecurityNumber)
return null; ///PERSON DOESNT EXIST
///PERSON INSTANCE EXISTS, CAST OBJECT INSTANCE INTO PERSON BEFORE RETURNING
return (Person)table[socialSecurityNumber];
}
}
Hope this clears a few things up for you, good luck!