private bool IsNormalized(String strInput)
{
if (strInput == null)
throw new ArgumentNullException(
Environment.GetResourceString("ArgumentNull_String"), "strInput");
int iError = ERROR_SUCCESS;
int iTest = nativeNormalizationIsNormalizedString(
normalizationForm, ref iError, strInput, strInput.Length);
switch(iError)
{
// Success doesn't need to do anything
case ERROR_SUCCESS:
break;
// Do appropriate stuff for the individual errors:
// Only possible value here is ERROR_NO_UNICODE_TRANSLATION
case ERROR_NO_UNICODE_TRANSLATION:
throw new ArgumentException(
Environment.GetResourceString("Argument_InvalidCharSequenceNoIndex" ),
"strInput");
case ERROR_NOT_ENOUGH_MEMORY:
throw new OutOfMemoryException(
Environment.GetResourceString("Arg_OutOfMemoryException"));
default:
throw new InvalidOperationException(
Environment.GetResourceString("UnknownError_Num", iError));
}
// Bit 1 is true, 0 is false from our return value.
return ((iTest & 1) == 1);
}