GacMembershipCondition.Equals(Object) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
指示当前对象是否等效于指定的对象。
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
要与当前对象进行比较的对象。
返回
如果 o
为 GacMembershipCondition,则为 true
;否则为 false
。
实现
示例
下面的代码示例演示了该方法 Equals 的使用。 此示例是为类提供的大型示例的 GacMembershipCondition 一部分。
GacMembershipCondition ^ Gac1 = gcnew GacMembershipCondition;
GacMembershipCondition ^ Gac2 = gcnew GacMembershipCondition;
// Roundtrip a GacMembershipCondition to and from an XML encoding.
Gac2->FromXml(Gac1->ToXml());
bool result = Gac2->Equals(Gac1);
if (result)
{
Console::WriteLine("Result of ToXml() = {0}", Gac2->ToXml());
Console::WriteLine(
"Result of ToFromXml roundtrip = {0}", Gac2);
}
else
{
Console::WriteLine(Gac2->ToString());
Console::WriteLine(Gac1->ToString());
return false;
}
GacMembershipCondition Gac1 = new GacMembershipCondition();
GacMembershipCondition Gac2 = new GacMembershipCondition();
// Roundtrip a GacMembershipCondition to and from an XML encoding.
Gac2.FromXml(Gac1.ToXml());
bool result = Gac2.Equals(Gac1);
if (result)
{
Console.WriteLine(
"Result of ToXml() = " + Gac2.ToXml().ToString());
Console.WriteLine(
"Result of ToFromXml roundtrip = " + Gac2.ToString());
}
else
{
Console.WriteLine(Gac2.ToString());
Console.WriteLine(Gac1.ToString());
return false;
}
Dim Gac1 As New GacMembershipCondition
Dim Gac2 As New GacMembershipCondition
' Roundtrip a GacMembershipCondition to and from an XML encoding.
Gac2.FromXml(Gac1.ToXml())
Dim result As Boolean = Gac2.Equals(Gac1)
If result Then
Console.WriteLine(("Result of ToXml() = " & _
Gac2.ToXml().ToString()))
Console.WriteLine(("Result of ToFromXml roundtrip = " & _
Gac2.ToString()))
Else
Console.WriteLine(Gac2.ToString())
Console.WriteLine(Gac1.ToString())
Return False
End If
注解
全局程序集缓存成员身份没有度。 程序集要么在缓存中,要么不在缓存中。 如果标识的对象 o
是一个 GacMembershipCondition,则比较的对象是相等的。 此方法仅当o
为null
或o
不是GacMembershipCondition时返回 false
。