rud*_*ter 5 c# types keyword isinstance
Are the following code snippets equivalent?
class a
{}
class b:a
{}
b foo=new b();
Run Code Online (Sandbox Code Playgroud)
//here it comes
foo is a
Run Code Online (Sandbox Code Playgroud)
//...is the same as...
typeof(a).isinstanceoftype(foo)
Run Code Online (Sandbox Code Playgroud)
或者也许其中一个其他类型方法映射更接近于运算符.例如"IsAssignableFrom"或"IsSubclassOf"
归档时间: |
|
查看次数: |
1301 次 |
最近记录: |