本文整理匯總了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;
}