GacInstalled.Equals(Object) Metode
Definisi
Penting
Beberapa informasi terkait produk prarilis yang dapat diubah secara signifikan sebelum dirilis. Microsoft tidak memberikan jaminan, tersirat maupun tersurat, sehubungan dengan informasi yang diberikan di sini.
Menunjukkan apakah objek saat ini setara dengan objek yang ditentukan.
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
Parameter
- o
- Object
Objek untuk dibandingkan dengan objek saat ini.
Mengembalikan
true
jika o
adalah GacInstalled objek; jika tidak, false
.
Contoh
Contoh kode berikut menunjukkan penggunaan Equals metode . Contoh ini adalah bagian dari contoh yang lebih besar yang disediakan untuk GacInstalled kelas .
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
Keterangan
GacInstalled objek tidak memiliki properti untuk membedakan satu sama lain, sehingga semua GacInstalled objek sama.