Guid.Equals 方法

定義

傳回值,這個值表示 Guid 的兩個執行個體是否代表相同的值。Returns a value that indicates whether two instances of Guid represent the same value.

多載

Equals(Guid)

傳回值,該值表示這個執行個體和指定的 Guid 物件是否代表相同值。Returns a value indicating whether this instance and a specified Guid object represent the same value.

Equals(Object)

傳回值,這個值指出此執行個體是否與指定的物件相等。Returns a value that indicates whether this instance is equal to a specified object.

Equals(Guid)

傳回值,該值表示這個執行個體和指定的 Guid 物件是否代表相同值。Returns a value indicating whether this instance and a specified Guid object represent the same value.

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

參數

g
Guid

與這個執行個體相比較的物件。An object to compare to this instance.

傳回

Boolean

如果 g 等於這個執行個體則為 true,否則為 falsetrue if g is equal to this instance; otherwise, false.

實作

備註

如果兩個 Guid 的物件具有相同的位元組值,則兩者相等。Two Guid objects are equal if they have identical byte values.

這個方法的執行效果稍微優於 Equals 方法,因為它不需要 box g 參數。This method performs slightly better than the Equals method because it does not have to box the g parameter.

另請參閱

Equals(Object)

傳回值,這個值指出此執行個體是否與指定的物件相等。Returns a value that indicates whether this instance is equal to a specified object.

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

參數

o
Object

與這個執行個體相互比較的物件。The object to compare with this instance.

傳回

Boolean

如果 o 是與這個執行個體有相同值的 Guid,則為 true,否則為 falsetrue if o is a Guid that has the same value as this instance; otherwise, false.

備註

如果兩個 Guid 的物件具有相同的位元組值,則兩者相等。Two Guid objects are equal if they have identical byte values.

適用於