{
public partial class TextInfo
{
- enum TurkishCasing
- {
- NotInitialized,
- NotNeeded,
- Needed
- }
-
[NonSerialized]
- private TurkishCasing _needsTurkishCasing = TurkishCasing.NotInitialized;
+ private Tristate _needsTurkishCasing = Tristate.NotInitialized;
//////////////////////////////////////////////////////////////////////////
////
}
else
{
- if (_needsTurkishCasing == TurkishCasing.NotInitialized)
+ if (_needsTurkishCasing == Tristate.NotInitialized)
{
- _needsTurkishCasing = NeedsTurkishCasing(_textInfoName) ? TurkishCasing.Needed : TurkishCasing.NotNeeded;
+ _needsTurkishCasing = NeedsTurkishCasing(_textInfoName) ? Tristate.True : Tristate.False;
}
- if ( _needsTurkishCasing == TurkishCasing.Needed)
+ if (_needsTurkishCasing == Tristate.True)
{
Interop.GlobalizationInterop.ChangeCaseTurkish(src, srcLen, dstBuffer, dstBufferCapacity, bToUpper);
}
//// Internal Information //
////--------------------------------------------------------------------//
+ private enum Tristate : byte
+ {
+ NotInitialized,
+ True,
+ False,
+ }
+
////
//// Variables.
////
[NonSerialized]
private String _textInfoName; // Name of the text info we're using (ie: _cultureData.STEXTINFO)
[NonSerialized]
- private bool? _isAsciiCasingSameAsInvariant;
+ private Tristate _isAsciiCasingSameAsInvariant = Tristate.NotInitialized;
// Invariant text info
internal static TextInfo Invariant
{
get
{
- if (_isAsciiCasingSameAsInvariant == null)
+ if (_isAsciiCasingSameAsInvariant == Tristate.NotInitialized)
{
_isAsciiCasingSameAsInvariant = CultureInfo.GetCultureInfo(_textInfoName).CompareInfo.Compare("abcdefghijklmnopqrstuvwxyz",
"ABCDEFGHIJKLMNOPQRSTUVWXYZ",
- CompareOptions.IgnoreCase) == 0;
+ CompareOptions.IgnoreCase) == 0 ? Tristate.True : Tristate.False;
}
- return (bool)_isAsciiCasingSameAsInvariant;
+ return _isAsciiCasingSameAsInvariant == Tristate.True;
}
}
// Internal Information //
//--------------------------------------------------------------------//
+ private enum Tristate : byte
+ {
+ NotInitialized,
+ True,
+ False,
+ }
//
// Variables.
[NonSerialized]private String m_textInfoName; // Name of the text info we're using (ie: m_cultureData.STEXTINFO)
[NonSerialized]private IntPtr m_dataHandle; // Sort handle
[NonSerialized]private IntPtr m_handleOrigin;
- [NonSerialized]private bool? m_IsAsciiCasingSameAsInvariant;
+ [NonSerialized]private Tristate m_IsAsciiCasingSameAsInvariant = Tristate.NotInitialized;
// Invariant text info
{
get
{
- if (m_IsAsciiCasingSameAsInvariant == null)
+ if (m_IsAsciiCasingSameAsInvariant == Tristate.NotInitialized)
{
m_IsAsciiCasingSameAsInvariant =
CultureInfo.GetCultureInfo(m_textInfoName).CompareInfo.Compare("abcdefghijklmnopqrstuvwxyz",
"ABCDEFGHIJKLMNOPQRSTUVWXYZ",
- CompareOptions.IgnoreCase) == 0;
+ CompareOptions.IgnoreCase) == 0 ? Tristate.True : Tristate.False;
}
- return (bool)m_IsAsciiCasingSameAsInvariant;
+ return m_IsAsciiCasingSameAsInvariant == Tristate.True;
}
}