private Type CheckChoiceIdentifierType(Type type, bool isArrayLike, string identifierName, string memberName)
{
if (type.IsArray)
{
if (!isArrayLike)
{
// Inconsistent type of the choice identifier '{0}'. Please use {1}.
throw new InvalidOperationException(SR.Format(SR.XmlChoiceIdentifierType, identifierName, memberName, type.GetElementType().FullName));
}
type = type.GetElementType();
}
else if (isArrayLike)
{
// Inconsistent type of the choice identifier '{0}'. Please use {1}.
throw new InvalidOperationException(SR.Format(SR.XmlChoiceIdentifierArrayType, identifierName, memberName, type.FullName));
}
if (!type.GetTypeInfo().IsEnum)
{
// Choice identifier '{0}' must be an enum.
throw new InvalidOperationException(SR.Format(SR.XmlChoiceIdentifierTypeEnum, identifierName));
}
return type;
}