1:other.GetType()与typeof(other)有什么区别?如果没区别为什么编译效果不一样2: public ILineSymbol LineSymbol()
{
get;
{ return null;
}
set;
{ }
}与
public ILineSymbol LineSymbol
{
get
{ return null;
}
set
{ }
}有什么区别?

解决方案 »

  1.   

    1:other.GetType();//other可以是类型名称,也可以是一个实例
    typeof(other);//other必须是一个类型名称2:我没见过这种写法
    public ILineSymbol LineSymbol()
    {
    get;
    { return null;
    }
    set;
    { }
    }
      

  2.   

    typeof(是类型)
    obj.GetType()//中的obj是一个实例它们的返回结果是一样的,都是System.Type类的一个实例(应该是这样吧)
      

  3.   

    具体属性中set访问器不能立即跟分号结束,除非是抽象的所以你的写法有问题而且随便说一个,你写一个属性,却返回null这是没有理由的,你应该返回一个相应类型的字段(域,以前称为变量)