{
static void Main( string [] args)
{
IATM account = new ATMMachine();
account.GetMoney( 600 );
Console.WriteLine(account.ToString());
Console.ReadKey();
}
}
public interface IATM
{
void GetMoney(Decimal amount);
}
public class ATMMachine : IATM
{
private Decimal b;
public void GetMoney(Decimal amount)
{
b += amount;
}
public override string ToString()
{
return String.Format( " Getted Money = {0,6:C} " , b);
}
}
另外我做如下猜测:通过接口所能访问的应该只有Class或者Struct,而只要是托管代码中的类型,不管是Class还是Struct都是继承于System.Object的(Struct继承于System.ValueType,而System.ValueType继承于System.Object),因此以上四个方法总是对外公开的,所以account.后边出现的是5个方法而不是1个。
最后,通过修改元数据可以去掉Extends : 01000000 ....然后编译成新的dll并且这个dll可用,我觉得这个时候的代码已经不是托管代码了,不符合CLS规范了,所以以此来推出并不是所有类型都继承于System.Object可能不太合适。

