实体类的一些注意点
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace User
{
internal class MyUser
{
private int userId = 123456;
private string username;
public MyUser(int userId, string username)
{
this.userId = userId;
this.username = username;
}
public MyUser()
{
}
public int Age{
get; set;
}
public int UserId
{
get {
return userId;
}
set
{
userId = value;
}
}
}
}
调用实体的一些注意点
namespace WindowsFormsApp1
{
internal static class Program
{
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
User.MyUser user = new User.MyUser();
user.UserId = 556;
Console.WriteLine(user.UserId);
}
}
}