namespace ConsoleAppTest
{
class Program
{
static void Main(string[] args)
{
Lazy<Student> student = new Lazy<Student>();
//默认未初始化
Console.WriteLine(student);
//在第一次使用时才实例化
Console.WriteLine(student.Value);
Console.ReadLine();
}
public class Student
{
public int ID
{
get; set;
}
public string Name
{
get; set;
}
}
}
}
来源:https://www.cnblogs.com/lgxlsm/p/8618311.html