Tuesday, November 27, 2007

What is diffrenece between string.compare and string.compareordinal

String.Compare can be or not be case-sensitive, and can incorporate anynumber of comparison options, including culture-sensitivity and sortingrules. That is, it is not comparing the exact strings necessarily, but canbe configured to do various sorts of comparisons. String.CompareOrdinalcompares the numeric values of the individual Unicode characters of thestrings. In other words, it is always case-sensitive, and neverculture-sensitive.

String.CompareOrdinal is faster (more efficient) when you don't need to do aculture-sensitive comparison, and you do want to do a case-sensitivecomparison.String.CompareTo is case-sensitive, using an Ordinal comparison, andculture-sensitive, but always uses the current culture. It is faster thanString.Compare, but less efficient than String.CompareOrdinal.
Share:

0 comments:

Post a Comment

Your feedback is very important to me. Please provide your feedback via putting comments.

Support this blog-Buy me a coffee

Buy me a coffeeBuy me a coffee
Search This Blog
Subscribe to my blog

  

My Mvp Profile
Follow us on facebook
Blog Archive
Total Pageviews