本文整理汇总了C#中IKVM.Reflection.Emit.TypeBuilder.__AddDeclarativeSecurity方法的典型用法代码示例。如果您正苦于以下问题:C# TypeBuilder.__AddDeclarativeSecurity方法的具体用法?C# TypeBuilder.__AddDeclarativeSecurity怎么用?C# TypeBuilder.__AddDeclarativeSecurity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IKVM.Reflection.Emit.TypeBuilder
的用法示例。
在下文中一共展示了TypeBuilder.__AddDeclarativeSecurity方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Apply
internal override void Apply(ClassLoaderWrapper loader, TypeBuilder tb, object annotation)
{
if (type == JVM.Import(typeof(System.Runtime.InteropServices.StructLayoutAttribute)) && tb.BaseType != Types.Object)
{
// we have to handle this explicitly, because if we apply an illegal StructLayoutAttribute,
// TypeBuilder.CreateType() will later on throw an exception.
#if STATIC_COMPILER
loader.IssueMessage(Message.IgnoredCustomAttribute, type.FullName, "Type '" + tb.FullName + "' does not extend cli.System.Object");
#else
Tracer.Error(Tracer.Runtime, "StructLayoutAttribute cannot be applied to {0}, because it does not directly extend cli.System.Object", tb.FullName);
#endif
return;
}
if (type.IsSubclassOf(Types.SecurityAttribute))
{
#if STATIC_COMPILER
tb.__AddDeclarativeSecurity(MakeCustomAttributeBuilder(loader, annotation));
#elif STUB_GENERATOR
#else
SecurityAction action;
PermissionSet permSet;
if (MakeDeclSecurity(type, annotation, out action, out permSet))
{
tb.AddDeclarativeSecurity(action, permSet);
}
#endif
}
else
{
tb.SetCustomAttribute(MakeCustomAttributeBuilder(loader, annotation));
}
}