GetEnumSchemaName static method

String? GetEnumSchemaName(
  1. Type enumType,
  2. Object enumValue
)
Gets the schema name for enum member. Type of the enum. The enum name.

Implementation

static String? GetEnumSchemaName(Type enumType, Object enumValue) {
  final ewsEnumAttribute = {
    MailboxType: {MailboxType.PublicGroup: EwsEnumAttribute("PublicDL")},
    MailboxType: {MailboxType.ContactGroup: EwsEnumAttribute("PrivateDL")}
  };

  if (ewsEnumAttribute.containsKey(enumType) &&
      ewsEnumAttribute[enumType]!.containsKey(enumValue)) {
    return ewsEnumAttribute[enumType]![enumValue as MailboxType]!.schemaName;
  } else {
    return null;
  }

//            MemberInfo[] memberInfo = enumType.GetMember(enumName);
//            EwsUtilities.Assert(
//                                (memberInfo != null) && (memberInfo.Length > 0),
//                                "EwsUtilities.GetEnumSchemaName",
//                                "Enum member " + enumName + " not found in " + enumType);
//
//            object[] attrs = memberInfo[0].GetCustomAttributes(typeof(EwsEnumAttribute), false);
//            if (attrs != null && attrs.Length > 0)
//            {
//                return ((EwsEnumAttribute)attrs[0]).SchemaName;
//            }
//            else
//            {
//                return null;
//            }
}