BitVector32.Equals 메서드
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
오버로드
Equals(BitVector32) |
현재 instance 동일한 형식의 다른 instance 같은지 여부를 나타냅니다. |
Equals(Object) |
지정된 개체가 BitVector32와 같은지 여부를 확인합니다. |
Equals(BitVector32)
- Source:
- BitVector32.cs
- Source:
- BitVector32.cs
- Source:
- BitVector32.cs
현재 instance 동일한 형식의 다른 instance 같은지 여부를 나타냅니다.
public:
virtual bool Equals(System::Collections::Specialized::BitVector32 other);
public bool Equals (System.Collections.Specialized.BitVector32 other);
override this.Equals : System.Collections.Specialized.BitVector32 -> bool
Public Function Equals (other As BitVector32) As Boolean
매개 변수
- other
- BitVector32
이 instance 비교할 instance.
반환
true
현재 instance 다른 instance 같으면 이고, false
그렇지 않으면 입니다.
구현
적용 대상
Equals(Object)
- Source:
- BitVector32.cs
- Source:
- BitVector32.cs
- Source:
- BitVector32.cs
지정된 개체가 BitVector32와 같은지 여부를 확인합니다.
public:
override bool Equals(System::Object ^ o);
public override bool Equals (object o);
public override bool Equals (object? o);
override this.Equals : obj -> bool
Public Overrides Function Equals (o As Object) As Boolean
매개 변수
- o
- Object
현재 BitVector32와 비교할 개체입니다.
반환
지정된 개체가 BitVector32와 같으면 true
이고, 그렇지 않으면 false
입니다.
예제
다음 코드 예제에서는 BitVector32 를 다른 BitVector32 와 비교하고 를 와 비교합니다 Int32.
#using <system.dll>
using namespace System;
using namespace System::Collections::Specialized;
int main()
{
// Creates and initializes a BitVector32 with the value 123.
// This is the BitVector32 that will be compared to different types.
BitVector32 myBV(123);
// Creates and initializes a new BitVector32 which will be set up as sections.
BitVector32 myBVsect(0);
// Compares myBV and myBVsect.
Console::WriteLine( "myBV : {0}", myBV );
Console::WriteLine( "myBVsect : {0}", myBVsect );
if ( myBV.Equals( myBVsect ) )
Console::WriteLine( " myBV( {0}) equals myBVsect( {1}).", myBV.Data, myBVsect.Data );
else
Console::WriteLine( " myBV( {0}) does not equal myBVsect( {1}).", myBV.Data, myBVsect.Data );
Console::WriteLine();
// Assigns values to the sections of myBVsect.
BitVector32::Section mySect1 = BitVector32::CreateSection( 5 );
BitVector32::Section mySect2 = BitVector32::CreateSection( 1, mySect1 );
BitVector32::Section mySect3 = BitVector32::CreateSection( 20, mySect2 );
myBVsect[ mySect1 ] = 3;
myBVsect[ mySect2 ] = 1;
myBVsect[ mySect3 ] = 7;
// Compares myBV and myBVsect.
Console::WriteLine( "myBV : {0}", myBV );
Console::WriteLine( "myBVsect with values : {0}", myBVsect );
if ( myBV.Equals( myBVsect ) )
Console::WriteLine( " myBV( {0}) equals myBVsect( {1}).", myBV.Data, myBVsect.Data );
else
Console::WriteLine( " myBV( {0}) does not equal myBVsect( {1}).", myBV.Data, myBVsect.Data );
Console::WriteLine();
// Compare myBV with an Int32.
Console::WriteLine( "Comparing myBV with an Int32: " );
Int32 myInt32 = 123;
// Using Equals will fail because Int32 is not compatible with BitVector32.
if ( myBV.Equals( myInt32 ) )
Console::WriteLine( " Using BitVector32::Equals, myBV( {0}) equals myInt32( {1}).", myBV.Data, myInt32 );
else
Console::WriteLine( " Using BitVector32::Equals, myBV( {0}) does not equal myInt32( {1}).", myBV.Data, myInt32 );
// To compare a BitVector32 with an Int32, use the "==" operator.
if ( myBV.Data == myInt32 )
Console::WriteLine( " Using the \"==\" operator, myBV.Data( {0}) equals myInt32( {1}).", myBV.Data, myInt32 );
else
Console::WriteLine( " Using the \"==\" operator, myBV.Data( {0}) does not equal myInt32( {1}).", myBV.Data, myInt32 );
}
/*
This code produces the following output.
myBV : BitVector32 {00000000000000000000000001111011}
myBVsect : BitVector32 {00000000000000000000000000000000}
myBV(123) does not equal myBVsect(0).
myBV : BitVector32 {00000000000000000000000001111011}
myBVsect with values : BitVector32 {00000000000000000000000001111011}
myBV(123) equals myBVsect(123).
Comparing myBV with an Int32:
Using BitVector32::Equals, myBV(123) does not equal myInt32(123).
Using the "==" operator, myBV.Data(123) equals myInt32(123).
*/
using System;
using System.Collections.Specialized;
public class SamplesBitVector32 {
public static void Main() {
// Creates and initializes a BitVector32 with the value 123.
// This is the BitVector32 that will be compared to different types.
BitVector32 myBV = new BitVector32( 123 );
// Creates and initializes a new BitVector32 which will be set up as sections.
BitVector32 myBVsect = new BitVector32( 0 );
// Compares myBV and myBVsect.
Console.WriteLine( "myBV : {0}", myBV.ToString() );
Console.WriteLine( "myBVsect : {0}", myBVsect.ToString() );
if ( myBV.Equals( myBVsect ) )
Console.WriteLine( " myBV({0}) equals myBVsect({1}).", myBV.Data, myBVsect.Data );
else
Console.WriteLine( " myBV({0}) does not equal myBVsect({1}).", myBV.Data, myBVsect.Data );
Console.WriteLine();
// Assigns values to the sections of myBVsect.
BitVector32.Section mySect1 = BitVector32.CreateSection( 5 );
BitVector32.Section mySect2 = BitVector32.CreateSection( 1, mySect1 );
BitVector32.Section mySect3 = BitVector32.CreateSection( 20, mySect2 );
myBVsect[mySect1] = 3;
myBVsect[mySect2] = 1;
myBVsect[mySect3] = 7;
// Compares myBV and myBVsect.
Console.WriteLine( "myBV : {0}", myBV.ToString() );
Console.WriteLine( "myBVsect with values : {0}", myBVsect.ToString() );
if ( myBV.Equals( myBVsect ) )
Console.WriteLine( " myBV({0}) equals myBVsect({1}).", myBV.Data, myBVsect.Data );
else
Console.WriteLine( " myBV({0}) does not equal myBVsect({1}).", myBV.Data, myBVsect.Data );
Console.WriteLine();
// Compare myBV with an Int32.
Console.WriteLine( "Comparing myBV with an Int32: " );
Int32 myInt32 = 123;
// Using Equals will fail because Int32 is not compatible with BitVector32.
if ( myBV.Equals( myInt32 ) )
Console.WriteLine( " Using BitVector32.Equals, myBV({0}) equals myInt32({1}).", myBV.Data, myInt32 );
else
Console.WriteLine( " Using BitVector32.Equals, myBV({0}) does not equal myInt32({1}).", myBV.Data, myInt32 );
// To compare a BitVector32 with an Int32, use the "==" operator.
if ( myBV.Data == myInt32 )
Console.WriteLine( " Using the \"==\" operator, myBV.Data({0}) equals myInt32({1}).", myBV.Data, myInt32 );
else
Console.WriteLine( " Using the \"==\" operator, myBV.Data({0}) does not equal myInt32({1}).", myBV.Data, myInt32 );
}
}
/*
This code produces the following output.
myBV : BitVector32{00000000000000000000000001111011}
myBVsect : BitVector32{00000000000000000000000000000000}
myBV(123) does not equal myBVsect(0).
myBV : BitVector32{00000000000000000000000001111011}
myBVsect with values : BitVector32{00000000000000000000000001111011}
myBV(123) equals myBVsect(123).
Comparing myBV with an Int32:
Using BitVector32.Equals, myBV(123) does not equal myInt32(123).
Using the "==" operator, myBV.Data(123) equals myInt32(123).
*/
Imports System.Collections.Specialized
Public Class SamplesBitVector32
Public Shared Sub Main()
' Creates and initializes a BitVector32 with the value 123.
' This is the BitVector32 that will be compared to different types.
Dim myBV As New BitVector32(123)
' Creates and initializes a new BitVector32 which will be set up as sections.
Dim myBVsect As New BitVector32(0)
' Compares myBV and myBVsect.
Console.WriteLine("myBV : {0}", myBV.ToString())
Console.WriteLine("myBVsect : {0}", myBVsect.ToString())
If myBV.Equals(myBVsect) Then
Console.WriteLine(" myBV({0}) equals myBVsect({1}).", myBV.Data, myBVsect.Data)
Else
Console.WriteLine(" myBV({0}) does not equal myBVsect({1}).", myBV.Data, myBVsect.Data)
End If
Console.WriteLine()
' Assigns values to the sections of myBVsect.
Dim mySect1 As BitVector32.Section = BitVector32.CreateSection(5)
Dim mySect2 As BitVector32.Section = BitVector32.CreateSection(1, mySect1)
Dim mySect3 As BitVector32.Section = BitVector32.CreateSection(20, mySect2)
myBVsect(mySect1) = 3
myBVsect(mySect2) = 1
myBVsect(mySect3) = 7
' Compares myBV and myBVsect.
Console.WriteLine("myBV : {0}", myBV.ToString())
Console.WriteLine("myBVsect with values : {0}", myBVsect.ToString())
If myBV.Equals(myBVsect) Then
Console.WriteLine(" myBV({0}) equals myBVsect({1}).", myBV.Data, myBVsect.Data)
Else
Console.WriteLine(" myBV({0}) does not equal myBVsect({1}).", myBV.Data, myBVsect.Data)
End If
Console.WriteLine()
' Compare myBV with an Int32.
Console.WriteLine("Comparing myBV with an Int32: ")
Dim myInt32 As Int32 = 123
' Using Equals will fail because Int32 is not compatible with BitVector32.
If myBV.Equals(myInt32) Then
Console.WriteLine(" Using BitVector32.Equals, myBV({0}) equals myInt32({1}).", myBV.Data, myInt32)
Else
Console.WriteLine(" Using BitVector32.Equals, myBV({0}) does not equal myInt32({1}).", myBV.Data, myInt32)
End If ' To compare a BitVector32 with an Int32, use the "==" operator.
If myBV.Data = myInt32 Then
Console.WriteLine(" Using the ""=="" operator, myBV.Data({0}) equals myInt32({1}).", myBV.Data, myInt32)
Else
Console.WriteLine(" Using the ""=="" operator, myBV.Data({0}) does not equal myInt32({1}).", myBV.Data, myInt32)
End If
End Sub
End Class
' This code produces the following output.
'
' myBV : BitVector32{00000000000000000000000001111011}
' myBVsect : BitVector32{00000000000000000000000000000000}
' myBV(123) does not equal myBVsect(0).
'
' myBV : BitVector32{00000000000000000000000001111011}
' myBVsect with values : BitVector32{00000000000000000000000001111011}
' myBV(123) equals myBVsect(123).
'
' Comparing myBV with an Int32:
' Using BitVector32.Equals, myBV(123) does not equal myInt32(123).
' Using the "==" operator, myBV.Data(123) equals myInt32(123).
설명
의 형식이 형식과 BitVector32 호환되고 값이 의 o
값 Datao
과 같으면 개체 o
는 과 같은 BitVector32 것으로 간주됩니다.
이 방법은 O(1) 작업에 설명 합니다.
적용 대상
GitHub에서 Microsoft와 공동 작업
이 콘텐츠의 원본은 GitHub에서 찾을 수 있으며, 여기서 문제와 끌어오기 요청을 만들고 검토할 수도 있습니다. 자세한 내용은 참여자 가이드를 참조하세요.
.NET