本文整理汇总了C#中Mono.Cecil.TypeDefinition.GetCustomAttributes方法的典型用法代码示例。如果您正苦于以下问题:C# TypeDefinition.GetCustomAttributes方法的具体用法?C# TypeDefinition.GetCustomAttributes怎么用?C# TypeDefinition.GetCustomAttributes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mono.Cecil.TypeDefinition
的用法示例。
在下文中一共展示了TypeDefinition.GetCustomAttributes方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FromTypeDefinition
public static BroadcastReceiverAttribute FromTypeDefinition(TypeDefinition type)
{
CustomAttribute attr = type.GetCustomAttributes ("Android.Content.BroadcastReceiverAttribute")
.SingleOrDefault ();
if (attr == null)
return null;
var self = new BroadcastReceiverAttribute ();
self.specified = mapping.Load (self, attr);
return self;
}
示例2: FromTypeDefinition
public static ServiceAttribute FromTypeDefinition(TypeDefinition type)
{
CustomAttribute attr = type.GetCustomAttributes ("Android.App.ServiceAttribute")
.SingleOrDefault ();
if (attr == null)
return null;
ServiceAttribute self = new ServiceAttribute ();
self.specified = mapping.Load (self, attr);
return self;
}
示例3: FromTypeDefinition
public static IEnumerable<GrantUriPermissionAttribute> FromTypeDefinition(TypeDefinition type)
{
IEnumerable<CustomAttribute> attrs = type.GetCustomAttributes ("Android.Content.GrantUriPermissionAttribute");
if (!attrs.Any ())
yield break;
foreach (CustomAttribute attr in attrs) {
var self = new GrantUriPermissionAttribute ();
self.specified = mapping.Load (self, attr);
yield return self;
}
}
示例4: FromTypeDefinition
public static IEnumerable<IntentFilterAttribute> FromTypeDefinition(TypeDefinition type)
{
IEnumerable<CustomAttribute> attrs = type.GetCustomAttributes ("Android.App.IntentFilterAttribute");
if (!attrs.Any ())
yield break;
foreach (CustomAttribute attr in attrs) {
var self = new IntentFilterAttribute (ToStringArray (attr.ConstructorArguments [0].Value));
foreach (var e in attr.Properties) {
self.specified.Add (e.Name);
setters [e.Name] (self, e.Argument.GetSettableValue ());
}
yield return self;
}
}
示例5: FromTypeDefinition
public static ContentProviderAttribute FromTypeDefinition(TypeDefinition type)
{
CustomAttribute attr = type.GetCustomAttributes ("Android.Content.ContentProviderAttribute")
.SingleOrDefault ();
if (attr == null)
return null;
var self = new ContentProviderAttribute (ToStringArray (attr.ConstructorArguments [0].Value));
self.specified = mapping.Load (self, attr);
self.specified.Add ("Authorities");
return self;
}