相关疑难解决方法(0)

C#类型比较:Type.Equals vs operator ==

Resharper建议改变以下内容:

Type foo = typeof( Foo );
Type bar = typeof( Bar );

if( foo.Equals( bar ) ) { ... }
Run Code Online (Sandbox Code Playgroud)

至:

if( foo == bar ) { ... }
Run Code Online (Sandbox Code Playgroud)

operator ==

// Summary:
//     Indicates whether two System.Type objects are equal.
//
// Parameters:
//   left:
//     The first object to compare.
//
//   right:
//     The second object to compare.
//
// Returns:
//     true if left is equal to right; otherwise, false.
public static bool operator ==( …
Run Code Online (Sandbox Code Playgroud)

c# types comparison-operators

40
推荐指数
1
解决办法
3万
查看次数

标签 统计

c# ×1

comparison-operators ×1

types ×1