Equality comparisons in C#:
==for simple value types or where use of operator overloads are desiredobject.Equals(a,b)for most scenarios where the type is unknown or comparison has potentially been overriddenstring.Equals(a,b,StringComparison)for comparing stringsobject.ReferenceEquals(a,b)for identity comparisons, which are usually the fastest
No comments:
Post a Comment