当前位置:首页 > Windows程序 > 正文

C# to IL Reference and Value Types(引用类型和值类型)

2024-03-31 Windows程序

An interface is a reference type, in spite of the fact that it has no code at all. Thus, we
cannot instantiate an interface. We can use it as a construct for the creation of new types.
An interface defines a contract that is left to the class to implement.
An interface can have static fields. If an interface contains 10 abstract virtual functions,
then the class implementing from that interface has to supply the code for all 10 of them.
Thus, if a class does not provide all the function implementations, then we cannot use the
class. In such a scenario, a class derived from it must provide the implementation.
The interface keyword in C# is a class, which the documentation describes as a semantic
attribute.

技术分享

We are not allowed to place any code in an interface. An interface consists only of the
function prototype, followed by a pair of curly braces {}

技术分享

技术分享

vijay1 is a function created in the interface yyy. As this is not permitted, the il assembler
has the domino effect as shown above

温馨提示: 本文由Jm博客推荐,转载请保留链接: https://www.jmwww.net/file/42996.html

Jm-杰米博客Jamie
草根站长的技术交流乐园!IT不会不要紧快来好好学习吧!
  • 20786文章总数
  • 7494595访问次数
  • 建站天数
  • 友情链接