zoukankan      html  css  js  c++  java
  • C# 延迟处理类 Lazy

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    
    namespace Lazy
    {
        class Program
        {
            static void Main(string[] args)
            {
                School aa = new School();
                List<student> ass=aa.lazy_students.Value;
                foreach (var m in ass)
                {
                    Console.WriteLine("姓名:{0} 年龄:{1},时间:{2}",m.name,m.age,m.date);
                }
                Console.ReadKey();
                
            }
        }
        public class School
        {
            public Lazy<List<student>> lazy_students { get; set; }
    
            public School()
            {
                lazy_students = new Lazy<List<student>>(() =>this.SetLazy());
            }
            private List<student> SetLazy()
            {
                List<student> ss = new List<student>{
                new  student{name="sx",age=18,date=DateTime.Now},
                new student{name="sb",age=19,date=DateTime.Now}
                
                
                };
                return ss;
            }
        }
        public class student
        {
            public string name { get; set; }
            public int age { get; set; }
            public DateTime date { get; set; }
        }
    }
  • 相关阅读:
    [转自大神]js拖拽小总结
    双飞翼布局
    圣杯布局
    页面伸缩布局实例
    css动画
    html的简单笔记01
    沙扬娜拉一首——赠日本女郎(徐志摩)
    滑动门功能
    边框圆角练习--跳动的心
    边框圆角
  • 原文地址:https://www.cnblogs.com/soundcode/p/5310901.html
Copyright © 2011-2022 走看看