コード例 #1
0
 public static SubDocumentAllowedType GetSubDocumentAllowedType(this Enum enumValue, 
                                                      SubDocumentAllowedType defaultValue = SubDocumentAllowedType.All)
 {
     var member = enumValue.GetType().GetMember(enumValue.ToString())[0];
     var attribute = member.GetCustomAttributes(typeof(AllowedForDocumentAttribute), false);
     if (!attribute.Any())
     {
         return defaultValue;
     }
     return ((AllowedForDocumentAttribute)attribute[0]).SubDocumentAllowed;
 }
コード例 #2
0
        public static SubDocumentAllowedType GetSubDocumentAllowedType(this Enum enumValue,
                                                                       SubDocumentAllowedType defaultValue = SubDocumentAllowedType.All)
        {
            var member    = enumValue.GetType().GetMember(enumValue.ToString())[0];
            var attribute = member.GetCustomAttributes(typeof(AllowedForDocumentAttribute), false);

            if (!attribute.Any())
            {
                return(defaultValue);
            }
            return(((AllowedForDocumentAttribute)attribute[0]).SubDocumentAllowed);
        }
コード例 #3
0
 public AllowedForDocumentAttribute(SubDocumentAllowedType subDocumentAllowed)
 {
     SubDocumentAllowed = subDocumentAllowed;
 }
コード例 #4
0
 public AllowedForDocumentAttribute(SubDocumentAllowedType subDocumentAllowed)
 {
     SubDocumentAllowed = subDocumentAllowed;
 }