[Mono-list] string equals method
Edward Ned Harvey (mono)
edward.harvey.mono at clevertrove.com
Tue May 21 22:25:39 UTC 2013
Msdn says string.Equals() overrides the string == operator.
Msdn also says it's an ordinal comparison, blah blah.
The thing I'd like to know: Ordinal string comparison tends to be an expensive thing to do. This can be skipped under certain circumstances, such as, if ReferenceEquals returns true, or if the two string length's are different.
Can anybody authoritatively say, under the hood, that .Net or mono actually do this sort of acceleration in the string.Equals() method?
public static bool operator ==( string a, string b)
if ( Object.ReferenceEquals(a,b) )
if ( a.Length != b.Length )
for ( int i=0; i<a.Length ; i++ )
if ( a[i] != b[i] )
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Mono-list