When ==
is used on an expression of type object
, it’ll resolve to System.Object.ReferenceEquals
.
Equals
is just a virtual
method and behaves as such, so the overridden version will be used (which, for string
type compares the contents).
More Related Contents:
- What’s the best strategy for Equals and GetHashCode?
- What’s the difference between IEquatable and just overriding Object.Equals()?
- What is the difference between IEqualityComparer and IEquatable?
- Is there a complete IEquatable implementation reference?
- Overriding GetHashCode for mutable objects?
- Deserialize JSON into C# dynamic object?
- Pass Method as Parameter using C#
- Random row from Linq to Sql
- Handling warning for possible multiple enumeration of IEnumerable
- Serializing private member data
- How can I use a reserved keyword as an identifier in my JSON model class?
- What is the difference between Linq to XML Descendants and Elements
- what is the max limit of data into list in c#?
- How to programmatically click a button in WPF?
- Memory Efficiency and Performance of String.Replace .NET Framework
- User Activity Logging, Telemetry (and Variables in Global Exception Handlers)
- SMTP and OAuth 2
- Flip the GraphicsPath that draws the text/string
- What’s the role of GetHashCode in the IEqualityComparer in .NET?
- What’s a good way of doing string templating in .NET?
- convert List to IList
- iTextSharp Creating a Footer Page # of #
- Parse string to enum type
- Merge cells in datagridview
- What does Process.Dispose() actually do?
- Ambiguous call between two C# extension generic methods one where T:class and other where T:struct
- Check if a SQL table exists
- .net connection pooling
- Garbage Collection not happening even when needed
- How do I get a directory size (files in the directory) in C#?