class
-
I have public class user where I have all my properties set for user (UserID,Name etc). Now I would like to create a new public class ListAllUser where I would add users with properties from user class. how can I do this?
//assuming your class name is called "Users"
List users = new List();
Users user = new Users();
user.UserId = 1;//assuming the id is of type "int"
user.Name = "Byka";//assuming this is indeed the user name
users.Add( user );//we are adding an instance of the User classYou can do this in a for/foreach loop if you are reading the users from the database. if that's the case, you can go
List users = new List();
for(int i=0;iHappy coding,
Morgs -
I have public class user where I have all my properties set for user (UserID,Name etc). Now I would like to create a new public class ListAllUser where I would add users with properties from user class. how can I do this?
excuse me but shouldn't this question really be asked in the language group for whatever language that you are developing with?? how do we know if you are using VB, c#, javascript, or c++??
as if the facebook, twitter and message boards weren't enough - blogged