Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 1. C# Language Elements > Item 9: Understand the Relationships Among Re...

Item 9: Understand the Relationships Among ReferenceEquals(), static Equals(), instance Equals(), and operator==

When you create your own types (either classes or structs), you define what equality means for that type. C# provides four different functions that determine whether two different objects are “equal”:

public static bool ReferenceEquals
  ( object left, object right );
public static bool Equals
  ( object left, object right );
public virtual bool Equals( object right);
public static bool operator==( MyClass left, MyClass right );


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint