當前位置: 首頁>>代碼示例>>C#>>正文


C# TypeDefinition.GetCustomAttributes方法代碼示例

本文整理匯總了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;
 }
開發者ID:yudhitech,項目名稱:xamarin-android,代碼行數:10,代碼來源:BroadcastReceiverAttribute.Partial.cs

示例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;
 }
開發者ID:yudhitech,項目名稱:xamarin-android,代碼行數:10,代碼來源:ServiceAttribute.Partial.cs

示例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;
     }
 }
開發者ID:yudhitech,項目名稱:xamarin-android,代碼行數:11,代碼來源:GrantUriPermissionAttribute.Partial.cs

示例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;
     }
 }
開發者ID:yudhitech,項目名稱:xamarin-android,代碼行數:14,代碼來源:IntentFilterAttribute.Partial.cs

示例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;
 }
開發者ID:yudhitech,項目名稱:xamarin-android,代碼行數:11,代碼來源:ContentProviderAttribute.Partial.cs


注:本文中的Mono.Cecil.TypeDefinition.GetCustomAttributes方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。