我有:
(1)类型枚举,如:
public enum Types : int
{
[ParametrizedContentTypeAttribute(typeOf(Type1ParamEnum))]
Type1 = 10,
[ParametrizedContentTypeAttribute(typeOf(Type2ParamEnum))]
Type2 = 20,
[ParametrizedContentTypeAttribute(typeOf(Type3ParamEnum))]
Type3 = 30
}
(2)参数枚举
public enum Type1ParamEnum : int
{
Type1Param1 = 10,
Type1Param2 = 20,
Type1Param3 = 30
}
public enum Type2ParamEnum : int
{
Type2Param1 = 10,
Type2Param2 = 20,
Type2Param3 = 30
}
public enum Type3ParamEnum : int
{
Type3Param1 = 10,
Type3Param2 = 20,
Type3Param3 = 30
}
(3)自定义属性
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
public class ParametrizedContentTypeAttribute : DescriptionAttribute
{
public ParametrizedContentTypeAttribute(Type parametersType)
{
ParametersType = parametersType;
}
public Type ParametersType { get; private set; }
}
如果我从 1. 中知道类型枚举成员的 Id,如何从 2. 中获取 Enums 的可用成员列表?