Show / Hide Table of Contents

    IDataStore.Equals(Object obj) Method

    .NET Standard 2.x | Current Version (1.0.1)

    0.5.0-alpha

    1.0.1 (current)

    Determines whether the specified object is equal to the current object. Inherited from Object.

    Namespace: PowerBuilder.Data

    Assembly: PowerBuilder.Data.dll

    Syntax

      public virtual bool Equals(Object obj);
    

    Parameters

    obj System.Object

    The object to compare with the current object.

    Returns

    System.bool

    Returns true if the specified object is equal to the current object; otherwise, false.

    Remarks

    The Equals method compares the reference address between the current DataStore and the specified object. If DataStores have the same data values but different reference address, this method returns false.

    Examples

    The following code example demonstrates how to use the Equals method.

    using PowerBuilder.Data;
    using System;
    
    namespace Appeon.ApiDoc.IDataStoreExamples
    {
        public class EqualsExample
        {
            private SchoolContext _context;
    
            public EqualsExample(SchoolContext dataContext)
            {
                // Sets the data context
                _context = dataContext;
            }
    
            public void Example()
            {
                // Instantiates the first DataStore object with datawindow: d_department.
                var datastore = new DataStore("d_department", _context);
    
                datastore.Retrieve();
    
                // Instantiates the second DataStore object with datawindow: d_department
                var datastore2 = new DataStore("d_department", _context);
    
                datastore2.Retrieve();
    
                // datastore and datastore2 have the same data, but different reference 
                // address, so returns false.
                Console.WriteLine("Equals: {0}", datastore.Equals(datastore2));
    
                // datastore and datastore3 have the same reference address, so returns 
                // true.
                var datastore3 = datastore;
    
                Console.WriteLine("Equals: {0}", datastore.Equals(datastore3));
    
                /*This code produces the following output:
                
                Equals: False
                Equals: True      
                */
            }
        }
    }
    

    Example Refer To

    DataWindow File: d_department

    Applies to

    .NET Standard

    2.x

    Back to top Generated by Appeon