本文整理汇总了C#中System.Attribute.IsValidSecurityAttribute方法的典型用法代码示例。如果您正苦于以下问题:C# Attribute.IsValidSecurityAttribute方法的具体用法?C# Attribute.IsValidSecurityAttribute怎么用?C# Attribute.IsValidSecurityAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Attribute
的用法示例。
在下文中一共展示了Attribute.IsValidSecurityAttribute方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ApplyAttributeBuilder
public override void ApplyAttributeBuilder (Attribute a, MethodSpec ctor, byte[] cdata, PredefinedAttributes pa)
{
if (a.IsValidSecurityAttribute ()) {
a.ExtractSecurityPermissionSet (ctor, ref declarative_security);
return;
}
if (a.Type == pa.StructLayout) {
PartialContainer.HasStructLayout = true;
if (a.IsExplicitLayoutKind ())
PartialContainer.HasExplicitLayout = true;
}
if (a.Type == pa.Dynamic) {
a.Error_MisusedDynamicAttribute ();
return;
}
base.ApplyAttributeBuilder (a, ctor, cdata, pa);
}
示例2: ApplyAttributeBuilder
public override void ApplyAttributeBuilder (Attribute a, MethodSpec ctor, byte[] cdata, PredefinedAttributes pa)
{
if (a.Type == pa.CLSCompliant || a.Type == pa.Obsolete || a.Type == pa.Conditional) {
Report.Error (1667, a.Location,
"Attribute `{0}' is not valid on property or event accessors. It is valid on `{1}' declarations only",
a.Type.GetSignatureForError (), a.GetValidTargets ());
return;
}
if (a.IsValidSecurityAttribute ()) {
a.ExtractSecurityPermissionSet (ctor, ref declarative_security);
return;
}
if (a.Target == AttributeTargets.Method) {
method_data.MethodBuilder.SetCustomAttribute ((ConstructorInfo) ctor.GetMetaInfo (), cdata);
return;
}
if (a.Target == AttributeTargets.ReturnValue) {
if (return_attributes == null)
return_attributes = new ReturnParameter (this, method_data.MethodBuilder, Location);
return_attributes.ApplyAttributeBuilder (a, ctor, cdata, pa);
return;
}
ApplyToExtraTarget (a, ctor, cdata, pa);
}