public class TestImpl : ITest
{
// Properties
public string Address
{
get
{
return "abc";
}
} //msil:address不是在接口中定义的
//hidebysig:使用时看不见这个方法,因为是给属性用的.specialname也是说是给属性用的(但不指明),只是说是特殊的.
.method public hidebysig specialname instance string get_Address() cil managed
{
.maxstack
.locals init (
[] string str)
L_0000: nop
L_0001: ldstr "abc"
L_0006: stloc.
L_0007: br.s L_0009
L_0009: ldloc.
L_000a: ret
}
public string Name
{
get
{
return "";
}
}
//name是在接定口定义的:
//多了newslot virtual final 这几个.
//
.method public hidebysig specialname newslot virtual final instance string get_Name() cil managed
{
.maxstack
L_0000: ldstr ""
L_0005: ret
}
int ITest.Age
{
get
{
return ;
}
set
{
}
}
//age是显示式实现的:
//不同点是用private修饰.其他的同上.get与set无区别.
.method private hidebysig specialname newslot virtual final instance void System.Reflection.ITest.set_Age(int32 'value') cil managed
{
.override System.Reflection.ITest::set_Age
.maxstack
L_0000: nop
L_0001: ret
} .method private hidebysig specialname newslot virtual final instance int32 System.Reflection.ITest.get_Age() cil managed
{
.override System.Reflection.ITest::get_Age
.maxstack
.locals init (
[] int32 num)
L_0000: nop
L_0001: ldc.i4.
L_0002: stloc.
L_0003: br.s L_0005
L_0005: ldloc.
L_0006: ret
} }
//c#中的:abstract
.method public hidebysig specialname newslot abstract virtual instance string get_Tel() cil managed
{
}
//C#中的virtual
.method public hidebysig specialname newslot virtual instance string get_Memo() cil managed
{
.maxstack
.locals init (
[] string str)
L_0000: nop
L_0001: ldstr ""
L_0006: stloc.
L_0007: br.s L_0009
L_0009: ldloc.
L_000a: ret
}

普通类

实现接口

1.属性方法

.method public hidebysig specialname instance
 
string get_Address() cil managed
.method public hidebysig specialname instance
newslot virtual final 
string get_Name() cil managed

2.显示实现

.method private hidebysig specialname instance
newslot virtual final 
int32 System.Reflection.ITest.get_Age() cil managed

3.Virtual

.method public hidebysig specialname instance
newslot virtual 
string get_普通Virtual属性() cil managed
.method public hidebysig specialname instance
newslot virtual final没了
string get_Memo() cil managed

4.Abstract

.method public hidebysig specialname instance
newslot abstract virtual 
 string get_普通Abstract属性() cil managed
.method public hidebysig specialname instance
newslot abstract virtual
string get_Tel() cil managed

5.New

.method public hidebysig specialname instance
编译时直接优化掉了.
string get_普通未覆盖基类属性() cil managed
.method public hidebysig specialname instance
newslot virtual final 与1相同
string get_接口NEW属性() cil managed
.method public hidebysig specialname instance 
//天哪,覆盖基类中的new关键字只是个c#中的语法il不管这事,编译时将被调用方法直接找到了?
string get_覆盖基类属性() cil managed

下面是ITest的定义.

public interface ITest
{
// Properties
int Age { get; set; }
string Name { get; }
}

最新文章

  1. Game02 最新版本2.0.0
  2. 繁华模拟赛day8 科技树
  3. KMP算法的Next数组详解
  4. web前端开发常用的10个高端CSS UI开源框架
  5. Linux中变量$#,$@,$0,$1,$2,$*,$$,$?的含义(转载)
  6. javascript实现继承的方式
  7. OpenDaylight之openflowjava的编译
  8. 如何删除ArcSde Service服务
  9. Linux的时钟管理
  10. JavaScript学习笔记(高级部分—02)
  11. Windows Azure使用体验
  12. ●POJ 2079 Triangle
  13. mysql进阶(十一)外键在数据库中的作用
  14. 关于UR=A的测试
  15. Linux matlab.desktop文件
  16. 简要描述 JavaScript 中定义函数的几种方式
  17. canvas.toDataURL 画布导出图片
  18. 将Integer赋值给int(空指针异常)
  19. WIN10平板 总是提示你需要管理员权限怎么办
  20. Maven依赖中的scope详解,在eclipse里面用maven install可以编程成功,到服务器上用命令执行报VM crash错误

热门文章

  1. wordpress利用rsync同步备份
  2. Win10下安装sulley
  3. Alpha 冲刺报告
  4. Java8新特性 -- Lambda 方法引用和构造器引用
  5. 安装VMware,Linux
  6. Center OS 7 /etc/rc.d/init.d/network, status=6
  7. BZOJ4180:字符串计数(SAM,二分,矩阵乘法)
  8. ElasticSearch 获取es信息以及索引操作
  9. iPhone 电脑备份路径
  10. 20155314 2016-2017-2 《Java程序设计》实验三 敏捷开发与XP实践