C# Object Creation from Datatable
- by Jonesy
Hi Folks,
Im just getting my head round C#. I've been creating classes and objects so say i created a class called Member:
public class Member
{
public int MemberID;
public string FirstName;
public string LastName;
public string UserName;
}
and i create a new object of that class by doing this:
Member Billy = new Member();
Billy.UserName = "Jonesy";
Billy.FirstName = "Billy";
Billy.LastName = "Jones";
Thats all fine but what if I've queried a database and gotten back 5 members, can I create objects on the fly? Or what is the best way to store these members in memory?
I've used VB.Net where I would just add them into a datatable. But I've never really done any object-oriented programming before and thought since I'm learning C sharp nows the best time to learn OOP..
Any help most appreciated!
Jonesy