0
我想创造这样的事情:CodeAttributeDeclaration - 自定义属性
[MyAttribute(HelperClass.Param,的ResourceType = typeof运算(资源))] 公共字符串美孚 {}
如何我可以创建这个自定义属性? 这是一张我的代码:
var configParamAttr = new CodeAttributeDeclaration { Name = "MyAttribute", Arguments = new CodeAttributeArgument { Name = "ResourceType", Value = new CodePrimitiveExpression("typeof(Resources)") } } };
currentProperty.CustomAttributes.Add(configParamAttr);
我不知道我怎么能投入自定义属性“HelperClass.Param”。这是其他班级不变的。另外我的'typeof(资源)是结果字符串:
[MyAttribute(ResourceType="typeof(Resources)")]
public string Foo
{
}
}
感谢您的回答。
我不想创建像这样的自定义属性。我想使用CodeAttributeDeclaration创建属性 – ogrod87 2014-10-05 19:08:43