by Michael S. Kaplan, published on 2006/09/15 03:01 -04:00, original URI: http://blogs.msdn.com/b/michkap/archive/2006/09/15/755173.aspx
pf.bai asked me via the Contacting Me link:
/// <summary>Indicates the default option settings for string comparisons.</summary>
CompareInfo.None = 0;
----
I found above message from MSDN about the CompareInfo.None.But I am not sure about what the "default option settings for string comparisons"
indicates.Ingnore case?Ignore symbols?Ignore the Kana type? or else
Now the topic under dicussion here is the table in CompareOptions.Enumeration topic.
And there is definitely a requirement to look at the numbers behind the enumeration values:
Member name | Description | Value |
---|---|---|
IgnoreCase
Supported by the .NET Compact Framework. |
Indicates that the string comparison must ignore case. | 1 |
IgnoreKanaType
Supported by the .NET Compact Framework. |
Indicates that the string comparison must ignore the Kana type. Kana type refers to Japanese hiragana and katakana characters, which represent phonetic sounds in the Japanese language. Hiragana is used for native Japanese expressions and words, while katakana is used for words borrowed from other languages, such as "computer" or "Internet". A phonetic sound can be expressed in both hiragana and katakana. If this value is selected, the hiragana character for one sound is considered equal to the katakana character for the same sound. | 8 |
IgnoreNonSpace
Supported by the .NET Compact Framework. |
Indicates that the string comparison must ignore nonspacing combining characters, such as diacritics. The Unicode Standard defines combining characters as characters that are combined with base characters to produce a new character. Nonspacing combining characters do not occupy a spacing position by themselves when rendered. For more information on nonspacing combining characters, see The Unicode Standard at http://www.unicode.org. | 2 |
IgnoreSymbols
Supported by the .NET Compact Framework. |
Indicates that the string comparison must ignore symbols, such as white-space characters, punctuation, currency symbols, the percent sign, mathematical symbols, the ampersand, and so on. | 4 |
IgnoreWidth
Supported by the .NET Compact Framework. |
Indicates that the string comparison must ignore the character width. For example, Japanese katakana characters can be written as full-width or half-width and, if this value is selected, the katakana characters written as full-width are considered equal to the same characters written in half-width. | 16 |
None
Supported by the .NET Compact Framework. |
Indicates the default option settings for string comparisons. | 0 |
Ordinal
Supported by the .NET Compact Framework. |
Indicates that the string comparison must be done using the Unicode values of each character, which is a fast comparison but is culture-insensitive. A string starting with "U+xxxx" comes before a string starting with "U+yyyy", if xxxx is less than yyyy. This flag cannot be combined with other flags and must be used alone. | 1073741824 |
StringSort
Supported by the .NET Compact Framework. |
Indicates that the string comparison must use the string sort algorithm, where the hyphen and the apostrophe, as well as other nonalphanumeric symbols, come before alphanumeric characters. | 536870912 |
In this case, since the number under CompareOptions.None is 0, it is the implicit value that is there when none of the other flags are passed. Because that is what the default option is -- no special compare flags.
Personally I hate these kind of entries in an enumeration, for the most part. They act as the one flag you cannot OR into other flags and have it do anything, and I usually find the number 0 to be just as intuitive. Maybe even more so.
Though there is one benefit in C# -- you don't need to cast to pass it. :-)
This post brought to you by ದ (U+0ca6, a.k.a. KANNADA LETTER DA)