2024年2月9日

摘要: readonly可以在构造函数中初始化,而const必须在声明时初始化 public class MyClass { public const int ConstValue = 10; public readonly int ReadOnlyValue = 10; public MyClass() 阅读全文
posted @ 2024-02-09 18:48 早起大王咻咻 阅读(4) 评论(0) 推荐(0) 编辑
 
摘要: C#中的using关键字通常使用于两种场景: 对于命名空间的引入 对于可释放资源的使用 对于命名空间的引入 using static 当要频繁的使用某个类中的方法的时候,可以using static System.Math,然后可以直接调用Cos(1);相当于静态使用了 global using 全 阅读全文
posted @ 2024-02-09 00:25 早起大王咻咻 阅读(19) 评论(0) 推荐(0) 编辑