Small C#[login to view URL] Webform iterating to the Fields of a Class-Object and produce Output of Fieldnames and values
We need a small Program doing the following:
We have a Class-File called [login to view URL] in the smlt Namespace:
in this File is the following:
Public class Customer
{
public int ID
public string FirstName
public String LastName
}
In the same File we have another class
public class CustomerData
{
public Customer getCustomerByID (int OrderID)
{
... reads from the Database and returns a Customer-Object...
}
}
What we want to accomplish:
In an .aspx Webform File
[login to view URL] Customer=[login to view URL]();
[login to view URL] myCustomer=[login to view URL]([login to view URL]([login to view URL]));
For simplicity You can create the myCustomer-Object and fill the Data as follows
myCustomer.ID=1;
myCustomer.FirstName="Thomas";
myCustomer.LastName="Schommartz";
Now the Problem:
We want to iterate to the Fields of the myCustomer-Object and generate the following Output:
ID, 1
FirstName, Thomas
LastName, Schommartz
But we DON'T want to refer to the Fields in the way
[login to view URL] [login to view URL];
It should be more the Kind
for each Field in myCustomer
{
write Fieldname, FieldValue
}
For people working with Reflection often that should not be a big deal.
## Deliverables
1) Complete and fully-functional working program(s) in executable form as well as complete source code of all work done.
2) Deliverables must be in ready-to-run condition, as follows (depending on the nature of the deliverables):
a) For web sites or other server-side deliverables intended to only ever exist in one place in the Buyer's environment--Deliverables must be in ready-to-run condition in the Buyer's environment.
3) All deliverables will be considered "work made for hire" under U.S. Copyright law. Buyer will receive exclusive and complete copyrights to all work purchased. (No GPL, GNU, 3rd party components, etc. unless all copyright ramifications are explained AND AGREED TO by the buyer on the site per the coder's Seller Legal Agreement).
## Platform
C#, ASP.NET, .NET Framework 1.1