随笔分类 -  C#相关

关于C#的接口的碎碎念
摘要:首先明确两件事情,1.C#的接口是引用类型的。2.值类型转引用类型时会发生装箱。 这样在我们设计一个容器类的时候大概率会遇到这种事: 我们希望继承某个接口用以表明身份,比如IEnumerable 或 IEnumerable<>这样我们需要一个GetEnumerator方法,然而我们又发现该接口的迭代 阅读全文

posted @ 2021-07-08 18:03 毛尹航 阅读(54) 评论(0) 推荐(0)

C#中接口是值类型还是引用类型?
摘要://测试代码 internal interface ITest1 { void Test1(); } class A:ITest1 { public void Test1(){} } struct B:ITest1 { public void Test1(){} } static class App 阅读全文

posted @ 2021-07-08 18:01 毛尹航 阅读(299) 评论(0) 推荐(0)