{"id":280510,"date":"2016-11-06T16:20:03","date_gmt":"2016-11-06T13:20:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=280510"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=280510","title":{"rendered":"\u041e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u043f\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e \u2014 2, \u0438\u043b\u0438 \u041e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u0435\u0442\u043e\u0434\u0430 Equals"},"content":{"rendered":"<h4>\u0412 <a href=\"https:\/\/habrahabr.ru\/post\/314328\/\">\u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438<\/a> \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043b\u0438 \u043e\u0431\u0449\u0438\u0435 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0445 \u0434\u043e\u0440\u0430\u0431\u043e\u0442\u043e\u043a \u043a\u043b\u0430\u0441\u0441\u0430 \u0434\u043b\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u043a\u043b\u0430\u0441\u0441\u0430 \u043f\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b .NET.<\/h4>\n<p>  \u042d\u0442\u0438 \u0434\u043e\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0432\u043a\u043b\u044e\u0447\u0430\u044e\u0442 \u043f\u0435\u0440\u0435\u043a\u0440\u044b\u0442\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 <a href=\"https:\/\/msdn.microsoft.com\/library\/bsc2ak47.aspx\">Object.Equals(Object)<\/a> \u0438 <a href=\"https:\/\/msdn.microsoft.com\/library\/system.object.gethashcode.aspx\">Object.GetHashCode()<\/a>.<\/p>\n<h4>\u041e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c\u0441\u044f \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043d\u0430 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044f\u0445 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u0435\u0442\u043e\u0434\u0430 <a href=\"https:\/\/msdn.microsoft.com\/library\/bsc2ak47.aspx\">Object.Equals(Object)<\/a> \u0434\u043b\u044f \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c\u0443 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044e \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438:<\/p>\n<\/h4>\n<pre><code>x.Equals(y) returns the same value as y.Equals(x).<\/code><\/pre>\n<p>  \/\/ \u0438, \u043a\u0430\u043a \u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0435, \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c\u0443:  <\/p>\n<pre><code>If (x.Equals(y) && y.Equals(z)) returns true, then x.Equals(z) returns true.<\/code><\/pre>\n<p>  \u041a\u043b\u0430\u0441\u0441 Person, \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 \u0432 <a href=\"https:\/\/habrahabr.ru\/post\/314328\/\">\u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438<\/a>, \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u043c\u0435\u0442\u043e\u0434\u0430 <a href=\"https:\/\/msdn.microsoft.com\/library\/bsc2ak47.aspx\">Equals(Object)<\/a>:  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">Person.Equals(Object)<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code>public override bool Equals(object obj) {     if ((object)this == obj)         return true;      var other = obj as Person;      if ((object)other == null)         return false;      return EqualsHelper(this, other); }<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0441\u0441\u044b\u043b\u043e\u0447\u043d\u043e\u0433\u043e \u0440\u0430\u0432\u0435\u043d\u0441\u0442\u0432\u0430 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u0438 \u0432\u0445\u043e\u0434\u044f\u0449\u0435\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430, \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438, \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0432\u0445\u043e\u0434\u044f\u0449\u0435\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u043a \u0442\u0438\u043f\u0430 Person \u0434\u043b\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u043f\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e.<\/p>\n<p>  \u0412 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u043c, \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u043c \u0432 <a href=\"https:\/\/msdn.microsoft.com\/library\/bsc2ak47.aspx\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/a>, \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 <a href=\"https:\/\/msdn.microsoft.com\/library\/cscsdfbt.aspx\">as<\/a>. \u041f\u0440\u043e\u0432\u0435\u0440\u0438\u043c, \u0434\u0430\u0435\u0442 \u043b\u0438 \u044d\u0442\u043e \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442.<br \/>  <a name=\"habracut\"><\/a><br \/>  \u0420\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u043a\u043b\u0430\u0441\u0441 PersonEx, \u0443\u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0432 \u043a\u043b\u0430\u0441\u0441 Person, \u0434\u043e\u0431\u0430\u0432\u0438\u0432 \u0432 \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e Middle Name, \u0438 \u043f\u0435\u0440\u0435\u043a\u0440\u044b\u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043c\u0435\u0442\u043e\u0434\u044b Person.Equals(Object) \u0438 Person.GetHashCode().<\/p>\n<p>  \u041a\u043b\u0430\u0441\u0441 PersonEx:  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">class PersonEx<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code>using System;  namespace HelloEquatable {     public class PersonEx : Person     {         public string MiddleName { get; }          public PersonEx(             string firstName, string middleName, string lastName, DateTime? birthDate         ) : base(firstName, lastName, birthDate)         {             this.MiddleName = NormalizeName(middleName);         }          public override int GetHashCode() =&gt;             base.GetHashCode() ^             this.MiddleName.GetHashCode();          protected static bool EqualsHelper(PersonEx first, PersonEx second) =&gt;             EqualsHelper((Person)first, (Person)second) &&             first.MiddleName == second.MiddleName;          public override bool Equals(object obj)         {             if ((object)this == obj)                 return true;              var other = obj as PersonEx;              if ((object)other == null)                 return false;              return EqualsHelper(this, other);         }     } }<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  \u041b\u0435\u0433\u043a\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u0443 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u043a\u043b\u0430\u0441\u0441\u0430 Person \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434 Equals(Object) \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0432 \u043d\u0435\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442 \u043a\u043b\u0430\u0441\u0441\u0430 PersonEx, \u0442\u043e, \u0435\u0441\u043b\u0438 \u0443 \u044d\u0442\u0438\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 (\u043f\u0435\u0440\u0441\u043e\u043d) \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u044e\u0442 \u0438\u043c\u044f, \u0444\u0430\u043c\u0438\u043b\u0438\u044f \u0438 \u0434\u0430\u0442\u0430 \u0440\u043e\u0436\u0434\u0435\u043d\u0438\u044f, \u043c\u0435\u0442\u043e\u0434 Equals \u0432\u043e\u0437\u0432\u0440\u0430\u0442\u0438\u0442 <a href=\"https:\/\/msdn.microsoft.com\/library\/6x6y6z4d.aspx\">true<\/a>, \u0432 \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u0435\u0442\u043e\u0434 \u0432\u043e\u0437\u0432\u0440\u0430\u0442\u0438\u0442 <a href=\"https:\/\/msdn.microsoft.com\/library\/67bxt5ee.aspx\">false<\/a>.<br \/>  (\u041f\u0440\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u043c\u0435\u0442\u043e\u0434\u0430 Equals, \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0439 \u043e\u0431\u044a\u0435\u043a\u0442, \u0438\u043c\u0435\u044e\u0449\u0438\u0439 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f (runtime) \u0442\u0438\u043f PersonEx, \u0431\u0443\u0434\u0435\u0442 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d \u043a \u0442\u0438\u043f\u0443 Person \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 <a href=\"https:\/\/msdn.microsoft.com\/library\/cscsdfbt.aspx\">as<\/a>, \u0438 \u0434\u0430\u043b\u0435\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u043f\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c \u043f\u043e\u043b\u0435\u0439, \u0438\u043c\u0435\u044e\u0449\u0438\u0445\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u043a\u043b\u0430\u0441\u0441\u0435 Person, \u0438 \u0431\u0443\u0434\u0435\u0442 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0435\u043d \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442.)<\/p>\n<p>  \u041e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u0441 \u043f\u0440\u0435\u0434\u043c\u0435\u0442\u043d\u043e\u0439 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u044d\u0442\u043e \u043d\u0435\u0432\u0435\u0440\u043d\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435:<br \/>  \u0421\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u0435 \u0438\u043c\u0435\u043d\u0438, \u0444\u0430\u043c\u0438\u043b\u0438\u0438 \u0438 \u0434\u0430\u0442\u044b \u0440\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u043d\u0435 \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u044d\u0442\u043e \u043e\u0434\u043d\u0430 \u0438 \u0442\u0430 \u0436\u0435 \u043f\u0435\u0440\u0441\u043e\u043d\u0430, \u0442.\u043a. \u0443 \u043e\u0434\u043d\u043e\u0439 \u043f\u0435\u0440\u0441\u043e\u043d\u044b \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0430\u0442\u0440\u0438\u0431\u0443\u0442 middle name (\u0440\u0435\u0447\u044c \u043d\u0435 \u043e \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0438 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430, \u0430 \u043e\u0431 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0438 \u0441\u0430\u043c\u043e\u0433\u043e \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430), \u0430 \u0443 \u0434\u0440\u0443\u0433\u043e\u0439 \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u0430\u0442\u0440\u0438\u0431\u0443\u0442 middle name.<br \/>  (\u042d\u0442\u043e \u0440\u0430\u0437\u043d\u044b\u0435 \u0442\u0438\u043f\u044b \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439.)<\/p>\n<p>  \u0415\u0441\u043b\u0438 \u0436\u0435, \u043d\u0430\u043f\u0440\u043e\u0442\u0438\u0432, \u0443 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u043a\u043b\u0430\u0441\u0441\u0430 PersonEx \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434 Equals(Object) \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0432 \u043d\u0435\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442 \u043a\u043b\u0430\u0441\u0441\u0430 Person, \u0442\u043e \u043c\u0435\u0442\u043e\u0434 Equals \u0432 \u043b\u044e\u0431\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0442\u0438\u0442 <a href=\"https:\/\/msdn.microsoft.com\/library\/67bxt5ee.aspx\">false<\/a>, \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e \u043e\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0441\u0432\u043e\u0439\u0441\u0442\u0432 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432.<br \/>  (\u041f\u0440\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u043c\u0435\u0442\u043e\u0434\u0430 Equals, \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0439 \u043e\u0431\u044a\u0435\u043a\u0442, \u0438\u043c\u0435\u044e\u0449\u0438\u0439 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f (runtime) \u0442\u0438\u043f Person, \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d \u043a \u0442\u0438\u043f\u0443 PersonEx \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 <a href=\"https:\/\/msdn.microsoft.com\/library\/cscsdfbt.aspx\">as<\/a> \u2014 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0431\u0443\u0434\u0435\u0442 <a href=\"https:\/\/msdn.microsoft.com\/library\/edakx9da.aspx\">null<\/a>, \u0438 \u043c\u0435\u0442\u043e\u0434 \u0432\u043e\u0437\u0432\u0440\u0430\u0442\u0438\u0442 <a href=\"https:\/\/msdn.microsoft.com\/library\/67bxt5ee.aspx\">false<\/a>.)<br \/>  \u0417\u0434\u0435\u0441\u044c \u043c\u044b \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0435\u043c \u0432\u0435\u0440\u043d\u043e\u0435 \u0441 \u043f\u0440\u0435\u0434\u043c\u0435\u0442\u043d\u043e\u0439 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435, \u0432 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u0441\u043b\u0443\u0447\u0430\u044f.<\/p>\n<p>  \u042d\u0442\u0438 \u0432\u0438\u0434\u044b \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043c\u043e\u0436\u043d\u043e \u043b\u0435\u0433\u043a\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c, \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434:  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u043e\u0434<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code>var person = new Person(&quot;John&quot;, &quot;Smith&quot;, new DateTime(1990, 1, 1)); var personEx = new PersonEx(&quot;John&quot;, &quot;Teddy&quot;, &quot;Smith&quot;, new DateTime(1990, 1, 1));  bool isSamePerson = person.Equals(personEx); bool isSamePerson2 = personEx.Equals(person);<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  \u041e\u0434\u043d\u0430\u043a\u043e, \u0432 \u0440\u0430\u0437\u0440\u0435\u0437\u0435 \u0434\u0430\u043d\u043d\u043e\u0439 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u043d\u0430\u0441 \u0432 \u0431\u043e\u043b\u044c\u0448\u0435\u0439 \u0441\u0442\u0435\u043f\u0435\u043d\u0438 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u0435\u0442 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f Equals(Object) \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f\u043c \u0432 <a href=\"https:\/\/msdn.microsoft.com\/library\/bsc2ak47.aspx\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/a>, \u043d\u0435\u0436\u0435\u043b\u0438 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0441\u0442\u044c \u043b\u043e\u0433\u0438\u043a\u0438 \u0441 \u043f\u0440\u0435\u0434\u043c\u0435\u0442\u043d\u043e\u0439 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f.<\/p>\n<p>  \u0410 \u0438\u043c\u0435\u043d\u043d\u043e \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0435 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044e:  <\/p>\n<pre><code>x.Equals(y) returns the same value as y.Equals(x).<\/code><\/pre>\n<p>  \u042d\u0442\u043e \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f.<\/p>\n<p>  (\u0410 \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u0437\u0434\u0440\u0430\u0432\u043e\u0433\u043e \u0441\u043c\u044b\u0441\u043b\u0430, \u043a\u0430\u043a\u0438\u0435 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u043f\u0440\u0438 \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 Equals(Object)?<br \/>  \u0423 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u0442\u0438\u043f\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0435\u0442 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438, \u043a\u0430\u043a\u0438\u043c \u0438\u043c\u0435\u043d\u043d\u043e \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c \u0431\u0443\u0434\u0443\u0442 \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u2014 x.Equals(y) \u0438\u043b\u0438 y.Equals(x) \u2014 \u043a\u0430\u043a \u0432 \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u043e\u043c \u043a\u043e\u0434\u0435 (\u043f\u0440\u0438 \u044f\u0432\u043d\u043e\u043c \u0432\u044b\u0437\u043e\u0432\u0435 Equals), \u0442\u0430\u043a \u0438 \u043f\u0440\u0438 \u043f\u043e\u043c\u0435\u0449\u0435\u043d\u0438\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0432 <a href=\"https:\/\/msdn.microsoft.com\/library\/bb359438.aspx\">\u0445\u0435\u0448-\u043d\u0430\u0431\u043e\u0440\u044b (\u0445\u0435\u0448-\u043a\u0430\u0440\u0442\u044b)<\/a> \u0438 <a href=\"https:\/\/msdn.microsoft.com\/library\/xfhwa508.aspx\">\u0441\u043b\u043e\u0432\u0430\u0440\u0438<\/a> (\u0432\u043d\u0443\u0442\u0440\u0438 \u0441\u0430\u043c\u0438\u0445 \u043d\u0430\u0431\u043e\u0440\u043e\u0432\/\u0441\u043b\u043e\u0432\u0430\u0440\u0435\u0439).<br \/>  \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0431\u0443\u0434\u0435\u0442 \u043d\u0435\u0434\u0435\u0442\u0435\u0440\u043c\u0438\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043e, \u0438 \u0437\u0430\u0432\u0438\u0441\u0435\u0442\u044c \u043e\u0442 \u0434\u0435\u0442\u0430\u043b\u0435\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438.)<\/p>\n<h4>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a\u0438\u043c \u0438\u043c\u0435\u043d\u043d\u043e \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434 Equals(Object), \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432 \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435.<\/h4>\n<p>  \u041d\u0430 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u044b\u043c \u0441\u043f\u043e\u0441\u043e\u0431, \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0439 \u0414\u0436\u0435\u0444\u0444\u0440\u0438 \u0420\u0438\u0445\u0442\u0435\u0440\u043e\u043c (Jeffrey Richter) \u0432 \u043a\u043d\u0438\u0433\u0435 CLR via C# (Part II: Designing Types, Chapter 5: Primitive, Reference, and Value Types, Subchapter \u00abObject Equality and Identity\u00bb), \u043a\u043e\u0433\u0434\u0430 \u043f\u0435\u0440\u0435\u0434 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435\u043c \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043f\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e, <a href=\"https:\/\/msdn.microsoft.com\/library\/system.type.aspx\">\u0442\u0438\u043f\u044b<\/a> \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f (runtime), \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0435\u0442\u043e\u0434\u0430 <a href=\"https:\/\/msdn.microsoft.com\/library\/system.object.gettype.aspx\">Object.GetType()<\/a> \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u044e\u0442\u0441\u044f \u043d\u0430 \u0440\u0430\u0432\u0435\u043d\u0441\u0442\u0432\u043e (\u0432\u043c\u0435\u0441\u0442\u043e \u043e\u0434\u043d\u043e\u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0445 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438\/\u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0442\u0438\u043f\u043e\u0432 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u043d\u0430 \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e\u0441\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 <a href=\"https:\/\/msdn.microsoft.com\/library\/cscsdfbt.aspx\">as<\/a>):  <\/p>\n<pre><code>if (this.GetType() != obj.GetType())     return false; <\/code><\/pre>\n<p>  \u0421\u043b\u0435\u0434\u0443\u0435\u0442 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0434\u0430\u043d\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0434\u043d\u043e\u0437\u043d\u0430\u0447\u043d\u044b\u043c, \u0442.\u043a. \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0442\u0440\u0438 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0441\u043f\u043e\u0441\u043e\u0431\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043d\u0430 \u0440\u0430\u0432\u0435\u043d\u0441\u0442\u0432\u043e \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043e\u0432 \u043a\u043b\u0430\u0441\u0441\u0430 <a href=\"https:\/\/msdn.microsoft.com\/library\/system.type.aspx\">Type<\/a>, \u0441 \u0442\u0435\u043e\u0440\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c\u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u043c\u0438 \u0434\u043b\u044f \u043e\u0434\u043d\u0438\u0445 \u0438 \u0442\u0435\u0445 \u0436\u0435 \u043e\u043f\u0435\u0440\u0430\u043d\u0434\u043e\u0432:<\/p>\n<p>  1. \u0421\u043e\u0433\u043b\u0430\u0441\u043d\u043e <a href=\"https:\/\/msdn.microsoft.com\/library\/system.object.gettype.aspx\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/a> \u043a \u043c\u0435\u0442\u043e\u0434\u0443 <a href=\"https:\/\/msdn.microsoft.com\/library\/system.object.gettype.aspx\">Object.GetType()<\/a>:<\/p>\n<pre><code>For two objects x and y that have identical runtime types, Object.ReferenceEquals(x.GetType(),y.GetType()) returns true. <\/code><\/pre>\n<p>  \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u043a\u043b\u0430\u0441\u0441\u0430 <a href=\"https:\/\/msdn.microsoft.com\/library\/system.type.aspx\">Type<\/a> \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u043d\u0430 \u0440\u0430\u0432\u0435\u043d\u0441\u0442\u0432\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435:<\/p>\n<pre><code>bool isEqualTypes = (object)obj1.GetType() == (object)obj2.GetType();<\/code><\/pre>\n<p>\u0438\u043b\u0438<\/p>\n<pre><code>bool isEqualTypes = Object.ReferenceEquals(obj1.GetType(), obj2.GetType());<\/code><\/pre>\n<p>  2. \u041a\u043b\u0430\u0441\u0441 <a href=\"https:\/\/msdn.microsoft.com\/library\/system.type.aspx\">Type<\/a> \u0438\u043c\u0435\u0435\u0442 \u043c\u0435\u0442\u043e\u0434\u044b <a href=\"https:\/\/msdn.microsoft.com\/library\/hh32dc75.aspx\">Equals(Object)<\/a> \u0438 <a href=\"https:\/\/msdn.microsoft.com\/library\/3ahwab82.aspx\">Equals(Type)<\/a>, \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<blockquote><p>Determines if the underlying system type of the current Type object is the same as the underlying system type of the specified Object.<\/p>\n<p>  Return Value<br \/>  Type: System.Boolean<br \/>  true if the underlying system type of o is the same as the underlying system type of the current Type; otherwise, false. This method also returns false if:<br \/>  o is null.<br \/>  o cannot be cast or converted to a Type object.<\/p>\n<p>  Remarks<br \/>  This method overrides Object.Equals. It casts o to an object of type Type and calls the Type.Equals(Type) method.<\/p><\/blockquote>\n<p>\u0438<\/p>\n<blockquote><p>Determines if the underlying system type of the current Type is the same as the underlying system type of the specified Type.<\/p>\n<p>  Return Value<br \/>  Type: System.Boolean<br \/>  true if the underlying system type of o is the same as the underlying system type of the current Type; otherwise, false.<\/p><\/blockquote>\n<p>  \u0412\u043d\u0443\u0442\u0440\u0438 \u044d\u0442\u0438 \u043c\u0435\u0442\u043e\u0434\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u044b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:  <\/p>\n<pre><code>public override bool Equals(Object o) {     if (o == null)         return false;      return Equals(o as Type); } <\/code><\/pre>\n<p>\u0438<\/p>\n<pre><code>public virtual bool Equals(Type o) {     if ((object)o == null)         return false;      return (Object.ReferenceEquals(this.UnderlyingSystemType, o.UnderlyingSystemType)); } <\/code><\/pre>\n<p>  \u041a\u0430\u043a \u0432\u0438\u0434\u0438\u043c, \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043e\u0431\u043e\u0438\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 Equals \u0434\u043b\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u043a\u043b\u0430\u0441\u0441\u0430 <a href=\"https:\/\/msdn.microsoft.com\/library\/system.type.aspx\">Type<\/a> \u0432 \u043e\u0431\u0449\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u043e\u0436\u0435\u0442 \u043e\u0442\u043b\u0438\u0447\u0430\u0442\u044c\u0441\u044f \u043e\u0442 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435, \u0442.\u043a. \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043c\u0435\u0442\u043e\u0434\u043e\u0432 Equals, \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435 \u043d\u0435 \u0441\u0430\u043c\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u043a\u043b\u0430\u0441\u0441\u0430 <a href=\"https:\/\/msdn.microsoft.com\/library\/system.type.aspx\">Type<\/a>, \u0430 \u0438\u0445 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 <a href=\"https:\/\/msdn.microsoft.com\/library\/system.type.underlyingsystemtype.aspx\">UnderlyingSystemType<\/a>, \u043e\u0442\u043d\u043e\u0441\u044f\u0449\u0438\u0435\u0441\u044f \u043a \u0442\u043e\u043c\u0443 \u0436\u0435 \u043a\u043b\u0430\u0441\u0441\u0443.<\/p>\n<p>  \u041e\u0434\u043d\u0430\u043a\u043e, \u0438\u0437 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043c\u0435\u0442\u043e\u0434\u043e\u0432 Equals \u043a\u043b\u0430\u0441\u0441\u0430 <a href=\"https:\/\/msdn.microsoft.com\/library\/hh32dc75.aspx\">Type.Equals(Object)<\/a> \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u043e\u043d\u0438 \u043d\u0435 \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u044b \u0434\u043b\u044f \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u043a\u043b\u0430\u0441\u0441\u0430 Type.<\/p>\n<p>  \u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435:<br \/>  \u0414\u043b\u044f \u043c\u0435\u0442\u043e\u0434\u0430 <a href=\"https:\/\/msdn.microsoft.com\/library\/hh32dc75.aspx\">Type.Equals(Object)<\/a> \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u043d\u0435\u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u044f \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044e (\u043a\u0430\u043a \u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 <a href=\"https:\/\/msdn.microsoft.com\/library\/cscsdfbt.aspx\">as<\/a>)<\/p>\n<pre><code>x.Equals(y) returns the same value as y.Equals(x).<\/code><\/pre>\n<p>\u043d\u0435 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0435\u0442, \u0442.\u043a. \u043a\u043b\u0430\u0441\u0441 <a href=\"https:\/\/msdn.microsoft.com\/library\/system.type.aspx\">Type<\/a> \u2014 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u0439, \u0435\u0441\u043b\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u043f\u043e\u0442\u043e\u043c\u043a\u0430\u0445 \u043a\u043b\u0430\u0441\u0441\u0430 \u043c\u0435\u0442\u043e\u0434 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u043a\u0440\u044b\u0442 \u043d\u0435\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c.<br \/>  \u0414\u043b\u044f \u043f\u0440\u0435\u0434\u043e\u0442\u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0439 \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0441\u0442\u043e\u0438\u043b\u043e \u043e\u0431\u044a\u044f\u0432\u0438\u0442\u044c \u043c\u0435\u0442\u043e\u0434 \u043a\u0430\u043a <a href=\"https:\/\/msdn.microsoft.com\/library\/88c54tsw.aspx\">sealed<\/a>.<\/p>\n<p>  3. \u041a\u043b\u0430\u0441\u0441 <a href=\"https:\/\/msdn.microsoft.com\/library\/system.type.aspx\">Type<\/a>, \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 .NET Framework 4.0, \u0438\u043c\u0435\u0435\u0442 \u043f\u0435\u0440\u0435\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u044b <a href=\"https:\/\/msdn.microsoft.com\/library\/system.type.op_equality.aspx\">==<\/a> \u0438\u043b\u0438 <a href=\"https:\/\/msdn.microsoft.com\/library\/system.type.op_inequality.aspx\">!=<\/a>, \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0431\u0435\u0437 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0434\u0435\u0442\u0430\u043b\u0435\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438:  <\/p>\n<blockquote><p>Indicates whether two Type objects are equal.<\/p>\n<p>  Return Value<br \/>  Type: System.Boolean<br \/>  true if left is equal to right; otherwise, false.<\/p><\/blockquote>\n<p>\u0438<\/p>\n<blockquote><p>Indicates whether two Type objects are not equal.<\/p>\n<p>  Return Value<br \/>  Type: System.Boolean<br \/>  true if left is not equal to right; otherwise, false.<\/p><\/blockquote>\n<p>\u0418\u0437\u0443\u0447\u0435\u043d\u0438\u0435 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0445 \u043a\u043e\u0434\u043e\u0432 \u0442\u043e\u0436\u0435 \u043d\u0435 \u0434\u0430\u0435\u0442 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043f\u043e \u0434\u0435\u0442\u0430\u043b\u044f\u043c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438, \u0434\u043b\u044f \u0432\u044b\u044f\u0441\u043d\u0435\u043d\u0438\u044f \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0439 \u043b\u043e\u0433\u0438\u043a\u0438 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432:  <\/p>\n<pre><code>public static extern bool operator ==(Type left, Type right);<\/code><\/pre>\n<pre><code>public static extern bool operator !=(Type left, Type right);<\/code><\/pre>\n<p>  \u0418\u0441\u0445\u043e\u0434\u044f \u0438\u0437 \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u0442\u0440\u0435\u0445 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u043a\u043b\u0430\u0441\u0441\u0430 <a href=\"https:\/\/msdn.microsoft.com\/library\/system.type.aspx\">Type<\/a>, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u044b\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432 &quot;==&quot; \u0438 &quot;!=&quot;, \u0438, \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 .NET \u043f\u0440\u0438 \u0441\u0431\u043e\u0440\u043a\u0435, \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0431\u0440\u0430\u043d \u043b\u0438\u0431\u043e \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435 (\u0438\u0434\u0435\u043d\u0442\u0438\u0447\u043d\u043e \u043f\u0435\u0440\u0432\u043e\u043c\u0443 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0443), \u043b\u0438\u0431\u043e \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043f\u0435\u0440\u0435\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432 &quot;==&quot; \u0438 &quot;!=&quot;.<\/p>\n<p>  \u0420\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u043a\u043b\u0430\u0441\u0441\u044b Person \u0438 PersonEx \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">class Person (with new Equals method)<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code>using System;  namespace HelloEquatable {     public class Person     {         protected static string NormalizeName(string name) =&gt; name?.Trim() ?? string.Empty;          protected static DateTime? NormalizeDate(DateTime? date) =&gt; date?.Date;          public string FirstName { get; }          public string LastName { get; }          public DateTime? BirthDate { get; }          public Person(string firstName, string lastName, DateTime? birthDate)         {             this.FirstName = NormalizeName(firstName);             this.LastName = NormalizeName(lastName);             this.BirthDate = NormalizeDate(birthDate);         }          public override int GetHashCode() =&gt;             this.FirstName.GetHashCode() ^             this.LastName.GetHashCode() ^             this.BirthDate.GetHashCode();          protected static bool EqualsHelper(Person first, Person second) =&gt;             first.BirthDate == second.BirthDate &&             first.FirstName == second.FirstName &&             first.LastName == second.LastName;          public override bool Equals(object obj)         {             if ((object)this == obj)                 return true;              if (obj == null)                 return false;              if (this.GetType() != obj.GetType())                 return false;              return EqualsHelper(this, (Person)obj);         }     } } <\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">class PersonEx  (with new Equals method)<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code>using System;  namespace HelloEquatable {     public class PersonEx : Person     {         public string MiddleName { get; }          public PersonEx(             string firstName, string middleName, string lastName, DateTime? birthDate         ) : base(firstName, lastName, birthDate)         {             this.MiddleName = NormalizeName(middleName);         }          public override int GetHashCode() =&gt;             base.GetHashCode() ^             this.MiddleName.GetHashCode();          protected static bool EqualsHelper(PersonEx first, PersonEx second) =&gt;             EqualsHelper((Person)first, (Person)second) &&             first.MiddleName == second.MiddleName;          public override bool Equals(object obj)         {             if ((object)this == obj)                 return true;              if (obj == null)                 return false;              if (this.GetType() != obj.GetType())                 return false;              return EqualsHelper(this, (PersonEx)obj);         }     } } <\/code><\/pre>\n<\/div>\n<\/div>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u0435 \u043a \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u0435\u0442\u043e\u0434\u0430 <a href=\"https:\/\/msdn.microsoft.com\/library\/bsc2ak47.aspx\">Equals(Object)<\/a> \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0431\u043b\u044e\u0434\u0430\u0442\u044c\u0441\u044f:<\/p>\n<pre><code>x.Equals(y) returns the same value as y.Equals(x).<\/code><\/pre>\n<p>  \u0447\u0442\u043e \u043b\u0435\u0433\u043a\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442\u0441\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435\u043c \u043a\u043e\u0434\u0430:<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u043e\u0434<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code>var person = new Person(&quot;John&quot;, &quot;Smith&quot;, new DateTime(1990, 1, 1)); var personEx = new PersonEx(&quot;John&quot;, &quot;Teddy&quot;, &quot;Smith&quot;, new DateTime(1990, 1, 1));  bool isSamePerson = person.Equals(personEx); bool isSamePerson2 = personEx.Equals(person);<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  \u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u044f \u043a \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u0435\u0442\u043e\u0434\u0430 Equals(Object):  <\/p>\n<ol>\n<li>\u0432\u043d\u0430\u0447\u0430\u043b\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u044e\u0442\u0441\u044f \u043d\u0430 \u0440\u0430\u0432\u0435\u043d\u0441\u0442\u0432\u043e \u0441\u0441\u044b\u043b\u043a\u0438, \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0449\u0438\u0435 \u043d\u0430 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u0438 \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0439 \u043e\u0431\u044a\u0435\u043a\u0442\u044b, \u0438, \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u044f \u0441\u0441\u044b\u043b\u043e\u043a, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f <a href=\"https:\/\/msdn.microsoft.com\/library\/6x6y6z4d.aspx\">true<\/a>;<\/li>\n<li>\u0437\u0430\u0442\u0435\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442\u0441\u044f \u043d\u0430 <a href=\"https:\/\/msdn.microsoft.com\/library\/edakx9da.aspx\">null<\/a> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0439 \u043e\u0431\u044a\u0435\u043a\u0442, \u0438, \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f <a href=\"https:\/\/msdn.microsoft.com\/library\/67bxt5ee.aspx\">false<\/a>;<\/li>\n<li>\u0437\u0430\u0442\u0435\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442\u0441\u044f \u0438\u0434\u0435\u043d\u0442\u0438\u0447\u043d\u043e\u0441\u0442\u044c \u0442\u0438\u043f\u043e\u0432 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u0438 \u0432\u0445\u043e\u0434\u044f\u0449\u0435\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430, \u0438, \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f <a href=\"https:\/\/msdn.microsoft.com\/library\/67bxt5ee.aspx\">false<\/a>;<\/li>\n<li>\u043d\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u043c \u044d\u0442\u0430\u043f\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u044f\u0442\u0441\u044f \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0432\u0445\u043e\u0434\u044f\u0449\u0435\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u043a \u0442\u0438\u043f\u0443 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 \u0438 \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u043f\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e.<\/li>\n<\/ol>\n<p>  <\/p>\n<h4>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043c\u044b \u043d\u0430\u0448\u043b\u0438 \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u043e\u0433\u043e \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043c\u0435\u0442\u043e\u0434\u0430 <a href=\"https:\/\/msdn.microsoft.com\/library\/bsc2ak47.aspx\">Equals(Object)<\/a>.<\/h4>\n<p>  \u0412 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u0438 \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 <a href=\"https:\/\/msdn.microsoft.com\/library\/ms131187.aspx\">IEquatable(Of T)<\/a> \u0438 type-specific \u043c\u0435\u0442\u043e\u0434\u0430 <a href=\"https:\/\/msdn.microsoft.com\/library\/ms131190.aspx\">IEquatable(Of T).Equals(T)<\/a>, \u043f\u0435\u0440\u0435\u0433\u0440\u0443\u0437\u043a\u0443 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432 \u0440\u0430\u0432\u0435\u043d\u0441\u0442\u0432\u0430 \u0438 \u043d\u0435\u0440\u0430\u0432\u0435\u043d\u0441\u0442\u0432\u0430 \u0434\u043b\u044f \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u043f\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e, \u0438 \u043d\u0430\u0439\u0434\u0435\u043c \u0441\u043f\u043e\u0441\u043e\u0431 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u043a\u043e\u043c\u043f\u0430\u043a\u0442\u043d\u043e, \u0441\u043e\u0433\u043b\u0430\u0441\u043e\u0432\u0430\u043d\u043d\u043e \u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u043e\u0434\u043d\u043e\u043c \u043a\u043b\u0430\u0441\u0441\u0435 \u0432\u0441\u0435 \u0432\u0438\u0434\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a \u043f\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e.<\/p>\n<h4>P.S. \u0410 \u043d\u0430 \u0434\u0435\u0441\u0435\u0440\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043c \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0441\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 <a href=\"https:\/\/msdn.microsoft.com\/library\/bsc2ak47.aspx\">Equals(Object)<\/a> \u0432 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435.<\/h4>\n<p>  \u041c\u0435\u0442\u043e\u0434 <a href=\"https:\/\/msdn.microsoft.com\/library\/f83xtf15.aspx\">Uri.Equals(Object)<\/a>:<\/p>\n<blockquote><p>Compares two Uri instances for equality.<\/p>\n<p>  Syntax<br \/>  public override bool Equals(object comparand)<\/p>\n<p>  Parameters<br \/>  comparand<br \/>  Type: System.Object<br \/>  The Uri instance or a URI identifier to compare with the current instance.<\/p>\n<p>  Return Value<br \/>  Type: System.Boolean<br \/>  A Boolean value that is true if the two instances represent the same URI; otherwise, false.<\/p><\/blockquote>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">Uri.Equals(Object)<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code>public override bool Equals(object comparand) {     if ((object)comparand == null)     {         return false;     }      if ((object)this == (object)comparand)     {         return true;     }      Uri obj = comparand as Uri;      \/\/     \/\/ we allow comparisons of Uri and String objects only. If a string     \/\/ is passed, convert to Uri. This is inefficient, but allows us to     \/\/ canonicalize the comparand, making comparison possible     \/\/     if ((object)obj == null)     {         string s = comparand as string;          if ((object)s == null)             return false;          if (!TryCreate(s, UriKind.RelativeOrAbsolute, out obj))             return false;     }      \/\/ method code ... } <\/code><\/pre>\n<\/div>\n<\/div>\n<p>  \u041b\u043e\u0433\u0438\u0447\u043d\u043e \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c, \u0447\u0442\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u0435 \u043a \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u0435\u0442\u043e\u0434\u0430 <a href=\"https:\/\/msdn.microsoft.com\/library\/bsc2ak47.aspx\">Equals(Object)<\/a> \u043d\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f:<\/p>\n<pre><code>x.Equals(y) returns the same value as y.Equals(x).<\/code><\/pre>\n<p>  \u0442.\u043a. \u043a\u043b\u0430\u0441\u0441 <a href=\"https:\/\/msdn.microsoft.com\/library\/system.string.aspx\">String<\/a> \u0438 \u043c\u0435\u0442\u043e\u0434 <a href=\"https:\/\/msdn.microsoft.com\/library\/fkfd9eh8.aspx\">String.Equals(Object)<\/a>, \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c, \u043d\u0435 \u00ab\u0437\u043d\u0430\u044e\u0442\u00bb \u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u0438\u0438 \u043a\u043b\u0430\u0441\u0441\u0430 <a href=\"https:\/\/msdn.microsoft.com\/library\/system.uri.aspx\">Uri<\/a>.<\/p>\n<p>  \u042d\u0442\u043e \u043b\u0435\u0433\u043a\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435, \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0432 \u043a\u043e\u0434:  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u043e\u0434<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code>const string uriString = &quot;https:\/\/www.habrahabr.ru&quot;; Uri uri = new Uri(uriString);  bool isSameUri = uri.Equals(uriString); bool isSameUri2 = uriString.Equals(uri);<\/code><\/pre>\n<\/div>\n<\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habrahabr.ru\/post\/314500\/\"> https:\/\/habrahabr.ru\/post\/314500\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<h4>\u0412 <a href=\"https:\/\/habrahabr.ru\/post\/314328\/\">\u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438<\/a> \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043b\u0438 \u043e\u0431\u0449\u0438\u0435 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0445 \u0434\u043e\u0440\u0430\u0431\u043e\u0442\u043e\u043a \u043a\u043b\u0430\u0441\u0441\u0430 \u0434\u043b\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u043a\u043b\u0430\u0441\u0441\u0430 \u043f\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b .NET.<\/h4>\n<p>  \u042d\u0442\u0438 \u0434\u043e\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0432\u043a\u043b\u044e\u0447\u0430\u044e\u0442 \u043f\u0435\u0440\u0435\u043a\u0440\u044b\u0442\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 <a href=\"https:\/\/msdn.microsoft.com\/library\/bsc2ak47.aspx\">Object.Equals(Object)<\/a> \u0438 <a href=\"https:\/\/msdn.microsoft.com\/library\/system.object.gethashcode.aspx\">Object.GetHashCode()<\/a>.<\/p>\n<h4>\u041e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c\u0441\u044f \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043d\u0430 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044f\u0445 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u0435\u0442\u043e\u0434\u0430 <a href=\"https:\/\/msdn.microsoft.com\/library\/bsc2ak47.aspx\">Object.Equals(Object)<\/a> \u0434\u043b\u044f \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c\u0443 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044e \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438:<\/p>\n<\/h4>\n<pre><code>x.Equals(y) returns the same value as y.Equals(x).<\/code><\/pre>\n<p>  \/\/ \u0438, \u043a\u0430\u043a \u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0435, \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c\u0443:  <\/p>\n<pre><code>If (x.Equals(y) &#038;& y.Equals(z)) returns true, then x.Equals(z) returns true.<\/code><\/pre>\n<p>  \u041a\u043b\u0430\u0441\u0441 Person, \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 \u0432 <a href=\"https:\/\/habrahabr.ru\/post\/314328\/\">\u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438<\/a>, \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u043c\u0435\u0442\u043e\u0434\u0430 <a href=\"https:\/\/msdn.microsoft.com\/library\/bsc2ak47.aspx\">Equals(Object)<\/a>:  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">Person.Equals(Object)<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code>public override bool Equals(object obj) {     if ((object)this == obj)         return true;      var other = obj as Person;      if ((object)other == null)         return false;      return EqualsHelper(this, other); }<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0441\u0441\u044b\u043b\u043e\u0447\u043d\u043e\u0433\u043e \u0440\u0430\u0432\u0435\u043d\u0441\u0442\u0432\u0430 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u0438 \u0432\u0445\u043e\u0434\u044f\u0449\u0435\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430, \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438, \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0432\u0445\u043e\u0434\u044f\u0449\u0435\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u043a \u0442\u0438\u043f\u0430 Person \u0434\u043b\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u043f\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e.<\/p>\n<p>  \u0412 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u043c, \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u043c \u0432 <a href=\"https:\/\/msdn.microsoft.com\/library\/bsc2ak47.aspx\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/a>, \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 <a href=\"https:\/\/msdn.microsoft.com\/library\/cscsdfbt.aspx\">as<\/a>. \u041f\u0440\u043e\u0432\u0435\u0440\u0438\u043c, \u0434\u0430\u0435\u0442 \u043b\u0438 \u044d\u0442\u043e \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-280510","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/280510","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=280510"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/280510\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=280510"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=280510"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=280510"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}