C#中readonly的使用方法

readonly只能在初始化的时候被赋值,在一户的使用过程中值不会被改变。

例如:

 private readonly DataBaseTestContext _context;

这个值在以后的使用过程中不会被改变。

猜你喜欢

转载自blog.csdn.net/zhaoqiong0929/article/details/80270623