Boolean.Equals Boolean.Equals Boolean.Equals Boolean.Equals Method

定义

返回一个值,该值指示此实例是否与指定的对象或 Boolean 相等。Returns a value indicating whether this instance is equal to a specified object or Boolean.

重载

Equals(Boolean) Equals(Boolean) Equals(Boolean) Equals(Boolean)

返回一个值,该值指示此实例是否与指定的 Boolean 相等。Returns a value indicating whether this instance is equal to a specified Boolean object.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

返回一个值,该值指示此实例是否等于指定的对象。Returns a value indicating whether this instance is equal to a specified object.

Equals(Boolean) Equals(Boolean) Equals(Boolean) Equals(Boolean)

返回一个值,该值指示此实例是否与指定的 Boolean 相等。Returns a value indicating whether this instance is equal to a specified Boolean object.

public:
 virtual bool Equals(bool obj);
public bool Equals (bool obj);
override this.Equals : bool -> bool
Public Function Equals (obj As Boolean) As Boolean

参数

obj
Boolean Boolean Boolean Boolean

要与此实例进行比较的 Boolean 值。A Boolean value to compare to this instance.

返回

如果 true 的值与此实例相同,则为 obj;否则为 falsetrue if obj has the same value as this instance; otherwise, false.

实现

注解

此方法实现接口System.IEquatable<T> ,并且执行的Equals效果略优于,因为obj无需将参数转换为对象。This method implements the System.IEquatable<T> interface, and performs slightly better than Equals because it does not have to convert the obj parameter to an object.

另请参阅

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

返回一个值,该值指示此实例是否等于指定的对象。Returns a value indicating whether this instance is equal to a specified object.

public:
 override bool Equals(System::Object ^ obj);
public override bool Equals (object obj);
override this.Equals : obj -> bool
Public Overrides Function Equals (obj As Object) As Boolean

参数

obj
Object Object Object Object

要与此实例进行比较的对象。An object to compare to this instance.

返回

如果 trueobj 且拥有与此实例相等的值,则为 Boolean;否则为 falsetrue if obj is a Boolean and has the same value as this instance; otherwise, false.

注解

此方法重写 EqualsThis method overrides Equals.

另请参阅

适用于