本文整理汇总了C#中System.Reflection.Emit.ConstructorBuilder.SetCustomAttribute方法的典型用法代码示例。如果您正苦于以下问题:C# ConstructorBuilder.SetCustomAttribute方法的具体用法?C# ConstructorBuilder.SetCustomAttribute怎么用?C# ConstructorBuilder.SetCustomAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Reflection.Emit.ConstructorBuilder
的用法示例。
在下文中一共展示了ConstructorBuilder.SetCustomAttribute方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ConstructorBuilderHelper
/// <summary>
/// Initializes a new instance of the <see cref="ConstructorBuilder"/> class
/// with the specified parameters.
/// </summary>
/// <param name="typeBuilder">Associated <see cref="TypeBuilderHelper"/>.</param>
/// <param name="constructorBuilder">A <see cref="ConstructorBuilder"/></param>
public ConstructorBuilderHelper(TypeBuilderHelper typeBuilder, ConstructorBuilder constructorBuilder)
: base(typeBuilder)
{
if (constructorBuilder == null) throw new ArgumentNullException("constructorBuilder");
_constructorBuilder = constructorBuilder;
_constructorBuilder.SetCustomAttribute(Type.Assembly.BLToolkitAttribute);
}
示例2: EmitAttribute
public void EmitAttribute (ConstructorBuilder builder)
{
if (ResolveBuilder ())
builder.SetCustomAttribute (cab);
}
示例3: AddDebuggerHiddenAttribute
/// <summary>
/// Adds a <see cref="DebuggerHiddenAttribute"/> to a constructor.
/// </summary>
/// <param name="constructor">The constructor to add the attribute.</param>
private static void AddDebuggerHiddenAttribute(ConstructorBuilder constructor)
{
Type attributeType = typeof(DebuggerHiddenAttribute);
CustomAttributeBuilder attribute = new CustomAttributeBuilder(attributeType.GetConstructor(new Type[0]), new object[0]);
constructor.SetCustomAttribute(attribute);
}
示例4: EmitCustomAttributes
private void EmitCustomAttributes(ConstructorBuilder ctorBuilder, IEnumerable<Cci.ICustomAttribute> attributes)
{
foreach (var attribute in attributes)
{
ctorBuilder.SetCustomAttribute(CreateCustomAttributeBuilder(attribute));
}
}
示例5: SetCustomAttributes
public static void SetCustomAttributes(ConstructorBuilder cb, IPersistentMap attributes)
{
foreach (CustomAttributeBuilder cab in CreateCustomAttributeBuilders(attributes))
cb.SetCustomAttribute(cab);
}
示例6: AddDebuggerHiddenAttribute
private static void AddDebuggerHiddenAttribute(ConstructorBuilder constructor)
{
var type = typeof(DebuggerHiddenAttribute);
var customBuilder = new CustomAttributeBuilder(type.GetConstructor(new Type[0]), new object[0]);
constructor.SetCustomAttribute(customBuilder);
}
示例7: DefineCustomAttributes
internal static void DefineCustomAttributes(ConstructorBuilder member, ReadOnlyCollection<AttributeAst> attributes, Parser parser, AttributeTargets attributeTargets)
{
if (attributes != null)
{
foreach (var attr in attributes)
{
var cabuilder = GetAttributeBuilder(parser, attr, attributeTargets);
if (cabuilder != null)
{
member.SetCustomAttribute(cabuilder);
}
}
}
}