다음을 통해 공유


SPChangeToken.Equals Method

Determines if the current instance is equal to another object, possibly of unknown type.

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: Yes
Available in SharePoint Online

Syntax

'Declaration
Public Overrides Function Equals ( _
    o As Object _
) As Boolean
'Usage
Dim instance As SPChangeToken
Dim o As Object
Dim returnValue As Boolean

returnValue = instance.Equals(o)
public override bool Equals(
    Object o
)

Parameters

Return Value

Type: System.Boolean
true if the current object is equal to the object passed in as an argument; otherwise, false.

Examples

The following example is a console application that compares an SPChangeToken object with another object.

Imports System
Imports Microsoft.SharePoint

Module ConsoleApp
   Sub Main()
      Using oSite As SPSite = New SPSite("https://localhost")
         Using oWeb As SPWeb = oSite.OpenWeb()

            Dim x As SPChangeToken = oWeb.CurrentChangeToken
            Dim y As Object = CType(oWeb.CurrentChangeToken, Object)
            Dim z As SPChangeToken = oSite.CurrentChangeToken

            ' SPChangeToken.Equals().
            Console.WriteLine(x.Equals(y))  ' True
            Console.WriteLine(x.Equals(z))  ' False

            ' System.Object.Equals().
            Console.WriteLine(y.Equals(x))  ' True
            Console.WriteLine(y.Equals(z))  ' False

         End Using
      End Using

      Console.Write(vbCrLf + "Press ENTER to continue...")
      Console.ReadLine()

   End Sub
End Module
using System;
using Microsoft.SharePoint;

namespace Test
{
   class ConsoleApp
   {
      static void Main(string[] args)
      {
         using (SPSite oSite = new SPSite("https://localhost"))
         {
            using (SPWeb oWeb = oSite.OpenWeb())
            {
               SPChangeToken x = oWeb.CurrentChangeToken;
               Object y = oWeb.CurrentChangeToken as Object;
               SPChangeToken z = oSite.CurrentChangeToken;

               // SPChangeToken.Equals().
               Console.WriteLine(x.Equals(y));  // True
               Console.WriteLine(x.Equals(z));  // False

               // System.Object.Equals().
               Console.WriteLine(y.Equals(x));  // True
               Console.WriteLine(y.Equals(z));  // False
            }
         }
         Console.Write("\nPress ENTER to continue...");
         Console.ReadLine();
      }
   }
}

See Also

Reference

SPChangeToken Class

SPChangeToken Members

Microsoft.SharePoint Namespace

Equality