C
CarlosSanchezJr
I have a User class that for example's sake looks something like this:
public class User
{
private int userId;
private string userName;
private string FirstName;
private string LastName;
public int UserId
{
get { return userId; }
set { userId = value; }
}
public int UserName
{
get { return userName; }
set { userName = value; }
}
public int FirstName
{
get { return firstName; }
set { firstName = value; }
}
public int LastName
{
get { return lastName; }
set { lastName = value; }
}
}
Now I understand if I want to create an instance of this on a code
behind page, I would do the following:
User user = new User();
user.UserId = 2;
etc....
What I want to know is, once I populate User with data, can I access
that data from a completely different page (than the one which
populated it or created the new instance)? Any help would be greatly
appreciated.
public class User
{
private int userId;
private string userName;
private string FirstName;
private string LastName;
public int UserId
{
get { return userId; }
set { userId = value; }
}
public int UserName
{
get { return userName; }
set { userName = value; }
}
public int FirstName
{
get { return firstName; }
set { firstName = value; }
}
public int LastName
{
get { return lastName; }
set { lastName = value; }
}
}
Now I understand if I want to create an instance of this on a code
behind page, I would do the following:
User user = new User();
user.UserId = 2;
etc....
What I want to know is, once I populate User with data, can I access
that data from a completely different page (than the one which
populated it or created the new instance)? Any help would be greatly
appreciated.