本文整理汇总了C#中IKVM.Reflection.Emit.MethodBuilder.__AddDeclarativeSecurity方法的典型用法代码示例。如果您正苦于以下问题:C# MethodBuilder.__AddDeclarativeSecurity方法的具体用法?C# MethodBuilder.__AddDeclarativeSecurity怎么用?C# MethodBuilder.__AddDeclarativeSecurity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IKVM.Reflection.Emit.MethodBuilder
的用法示例。
在下文中一共展示了MethodBuilder.__AddDeclarativeSecurity方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CopyLinkDemands
private static void CopyLinkDemands(MethodBuilder mb, MethodInfo mi)
{
foreach (CustomAttributeData cad in CustomAttributeData.__GetDeclarativeSecurity(mi))
{
if (cad.ConstructorArguments.Count == 0 || (int)cad.ConstructorArguments[0].Value == (int)SecurityAction.LinkDemand)
{
mb.__AddDeclarativeSecurity(cad.__ToBuilder());
}
}
}
示例2: Apply
internal override void Apply(ClassLoaderWrapper loader, MethodBuilder mb, object annotation)
{
if (type.IsSubclassOf(Types.SecurityAttribute))
{
#if STATIC_COMPILER
mb.__AddDeclarativeSecurity(MakeCustomAttributeBuilder(loader, annotation));
#elif STUB_GENERATOR
#else
SecurityAction action;
PermissionSet permSet;
if (MakeDeclSecurity(type, annotation, out action, out permSet))
{
mb.AddDeclarativeSecurity(action, permSet);
}
#endif
}
else
{
mb.SetCustomAttribute(MakeCustomAttributeBuilder(loader, annotation));
}
}