首页 > 其他分享 >Lazy用法

Lazy用法

时间:2023-02-28 10:14:37浏览次数:34  
标签:Lazy StudentID private 用法 StudentInfo studentLazy public

    public class StudentInfo 
    {
        public static StudentInfo studentLazy = new Lazy<StudentInfo>(() => new StudentInfo()).Value;
        public int StudentID{ get; set; }

    }


    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            StudentInfo.studentLazy.StudentID = 999;
        }

        private void Button1_Click(object sender, RoutedEventArgs e)
        {
            var test = StudentInfo.studentLazy.StudentID;
        }
    }

标签:Lazy,StudentID,private,用法,StudentInfo,studentLazy,public
From: https://www.cnblogs.com/NingNingG/p/17162940.html

相关文章

  • lsof命令用法
    一、lsof命令介绍lsof(listopenfiles)命令可以列出当前系统已经打开的所有文件。在Linux环境下,任何事物都以文件的形式存在,通过文件不仅仅可以访问常规数据,还可以访......
  • Python中logging模块用法
    一、低配logging日志总共分为以下五个级别,这个五个级别自下而上进行匹配debug-->info-->warning-->error-->critical,默认最低级别为warning级别。1.v1importlogging......
  • sys.argv的用法
    一、Pythonsys模块“sys”是“system”,是一个系统模块,该模块提供了一些接口,用户访问python解释器自身使用和维护的变量,同时模块中还提供了一些函数,而我们今天要讲解的......
  • React Hooks用法大全
    ReactHooks用法大全 前言在React的世界中,有容器组件和UI组件之分,在ReactHooks出现之前,UI组件我们可以使用函数,无状态组件来展示UI,而对于容器组件,函数组件......
  • flutter系列之:Navigator的高级用法
    目录简介namedroutes给namedroute传参数从Screen返回值向Screen传值总结简介上篇文章我们讲到了flutter中navigator的基本用法,我们可以使用它的push和pop方法来进行Rou......
  • javascript 高级编程 之 Array 用法总结
    引用类型是一种数据结构,用于将数据和功能联系起来。创建对象的方式:1.new操作符vararray=newArray();2.字面量表示法创建vararray=[];Array检测数组:检测数组......
  • 一文学会ftrace的基础用法
    0.官网https://www.kernel.org/doc/html/latest/trace/ftrace.html1.ftrace是什么ftrace是linux原生的一个trace工具,最早在2.6.27引入,跟踪能力强大,可以调试和分析诸如......
  • 目前最新的安卓Lodcat的用法:
    当我们在java文件中自己写入了一些log调试信息,如下图:  那此时我们如何在大量的后台日志中寻找出自己的log调试信息呢?如下图,我们在package:mine后面输入tag:mylog查找自......
  • PyTorch | torch.sum()函数的用法
    torch.sum()对输入的tensor数据的某一维度求和,一共两种用法。方法1详解torch.sum(input,*,dtype=None)→Tensorinput:输入的张量案例x=torch.randn(2,3)pri......
  • 蓝图通讯之事件分发器用法
    在事件分发器点加号添加一个分发器image.png在蓝图开始运行就进行绑定这个事件,image.png他会创建一个以分发器开头_事件的东西.而绑定类似,只......