你好,
你可以参考下方的小例子。
class Program
{
static void Main(string[] args)
{
Employee employee = new Employee
{
Name = "A",
ID = 0012,
Saraly = 666
};
var id = employee.ID;
}
}
public class Employee
{
public string Name;
public int ID;
public int Saraly;
}
Best Regards,
Wendy
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to
MSDN Support, feel free to contact MSDNFSF@microsoft.com.