G
GregoryJ
I have the following Class:
Public class Contact()
{
private int contactID;
private string contactName;
private datetime dateOfBirth;
public int ContactID
{
get { return contactID; }
set { contactID = return; }
}
public string ContactName
{
get { return contactName; }
set { contactName = return; }
}
public DateTime DateOfBirth
{
get { return dateOfBirth; }
set { dateOfBirth = return; }
}
}
This class contains three properties, ContactID, ContactName and
DateOfBirth. I'd like to examine the class without knowing anything about it,
other than the class' name. In other words, if I have instatiated the class,
is it possible to step throught the class properties via a loop without
knowing the property names?
Contact myContact = new Contact();
I'd like to get the name of the properties (ContactID, ContactName,
DateOfBirth), the data type of each property and the value of each property
when its initialized.
I don't want to refer to the ContactName as myContact.ContactName. I'm
looking to step though this class via a loop and get the "ContactName"
property and values.
Any help on achieving this would be appreciated.
Thanks.
Public class Contact()
{
private int contactID;
private string contactName;
private datetime dateOfBirth;
public int ContactID
{
get { return contactID; }
set { contactID = return; }
}
public string ContactName
{
get { return contactName; }
set { contactName = return; }
}
public DateTime DateOfBirth
{
get { return dateOfBirth; }
set { dateOfBirth = return; }
}
}
This class contains three properties, ContactID, ContactName and
DateOfBirth. I'd like to examine the class without knowing anything about it,
other than the class' name. In other words, if I have instatiated the class,
is it possible to step throught the class properties via a loop without
knowing the property names?
Contact myContact = new Contact();
I'd like to get the name of the properties (ContactID, ContactName,
DateOfBirth), the data type of each property and the value of each property
when its initialized.
I don't want to refer to the ContactName as myContact.ContactName. I'm
looking to step though this class via a loop and get the "ContactName"
property and values.
Any help on achieving this would be appreciated.
Thanks.