C#类型转换

§LinemyLine = (Line)myObject;

§as’操作符-Line myLine = myObjectasLine; - 

    §如果失败,没有异常,但对象为null !

§is’操作符–if  (myObj is Line) …

§typeof操作符 – if typeof (obj1) == typeof(obj2)…

§GetType - If obj1.GetType()  == obj2.GetType() …

原文地址:https://www.cnblogs.com/swtool/p/3828990.html