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


C# CSharp.MetadataImporter類代碼示例

本文整理匯總了C#中Mono.CSharp.MetadataImporter的典型用法代碼示例。如果您正苦於以下問題:C# MetadataImporter類的具體用法?C# MetadataImporter怎麽用?C# MetadataImporter使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


MetadataImporter類屬於Mono.CSharp命名空間,在下文中一共展示了MetadataImporter類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: IsDynamicObject

			//
			// Returns true when object at local position has dynamic attribute flag
			//
			public bool IsDynamicObject (MetadataImporter importer)
			{
				if (provider != null)
					ReadAttribute (importer);

				return flags != null && Position < flags.Length && flags[Position];
			}
開發者ID:Gobiner,項目名稱:ILSpy,代碼行數:10,代碼來源:import.cs

示例2: HasDynamicAttribute

			//
			// Returns true when DynamicAttribute exists
			//
			public bool HasDynamicAttribute (MetadataImporter importer)
			{
				if (provider != null)
					ReadAttribute (importer);

				return flags != null;
			}
開發者ID:Gobiner,項目名稱:ILSpy,代碼行數:10,代碼來源:import.cs

示例3: ReadAttribute

			void ReadAttribute (MetadataImporter importer)
			{
				IList<CustomAttributeData> cad;
				if (provider is MemberInfo) {
					cad = CustomAttributeData.GetCustomAttributes ((MemberInfo) provider);
				} else if (provider is ParameterInfo) {
					cad = CustomAttributeData.GetCustomAttributes ((ParameterInfo) provider);
				} else {
					provider = null;
					return;
				}

				if (cad.Count > 0) {
					string ns, name;
					foreach (var ca in cad) {
						importer.GetCustomAttributeTypeName (ca, out ns, out name);
						if (name != "DynamicAttribute" && ns != CompilerServicesNamespace)
							continue;

						if (ca.ConstructorArguments.Count == 0) {
							flags = single_attribute;
							break;
						}

						var arg_type = ca.ConstructorArguments[0].ArgumentType;

						if (arg_type.IsArray && MetaType.GetTypeCode (arg_type.GetElementType ()) == TypeCode.Boolean) {
							var carg = (IList<CustomAttributeTypedArgument>) ca.ConstructorArguments[0].Value;
							flags = new bool[carg.Count];
							for (int i = 0; i < flags.Length; ++i) {
								if (MetaType.GetTypeCode (carg[i].ArgumentType) == TypeCode.Boolean)
									flags[i] = (bool) carg[i].Value;
							}

							break;
						}
					}
				}

				provider = null;
			}
開發者ID:wuzzeb,項目名稱:mono,代碼行數:41,代碼來源:import.cs

示例4: ImportedTypeParameterDefinition

		public ImportedTypeParameterDefinition (MetaType type, MetadataImporter importer)
			: base (type, importer)
		{
		}
開發者ID:Gobiner,項目名稱:ILSpy,代碼行數:4,代碼來源:import.cs

示例5: ImportedGenericMethodDefinition

		public ImportedGenericMethodDefinition (MethodInfo provider, TypeSpec type, AParametersCollection parameters, TypeParameterSpec[] tparams, MetadataImporter importer)
			: base (provider, type, parameters, importer)
		{
			this.tparams = tparams;
		}
開發者ID:Gobiner,項目名稱:ILSpy,代碼行數:5,代碼來源:import.cs

示例6: ImportedParameterMemberDefinition

		public ImportedParameterMemberDefinition (PropertyInfo provider, TypeSpec type, AParametersCollection parameters, MetadataImporter importer)
			: base (provider, type, importer)
		{
			this.parameters = parameters;
		}
開發者ID:Gobiner,項目名稱:ILSpy,代碼行數:5,代碼來源:import.cs

示例7: ImportedMemberDefinition

		public ImportedMemberDefinition (MemberInfo member, TypeSpec type, MetadataImporter importer)
			: base (member, importer)
		{
			this.type = type;
		}
開發者ID:Gobiner,項目名稱:ILSpy,代碼行數:5,代碼來源:import.cs

示例8: ImportedDefinition

		public ImportedDefinition (MemberInfo provider, MetadataImporter importer)
		{
			this.provider = provider;
			this.importer = importer;
		}
開發者ID:Gobiner,項目名稱:ILSpy,代碼行數:5,代碼來源:import.cs

示例9: Read

			public static AttributesBag Read (MemberInfo mi, MetadataImporter importer)
			{
				AttributesBag bag = null;
				List<string> conditionals = null;

				// It should not throw any loading exception
				IList<CustomAttributeData> attrs = CustomAttributeData.GetCustomAttributes (mi);

				foreach (var a in attrs) {
					var dt = a.Constructor.DeclaringType;
					string name = dt.Name;
					if (name == "ObsoleteAttribute") {
						if (dt.Namespace != "System")
							continue;

						if (bag == null)
							bag = new AttributesBag ();

						var args = a.ConstructorArguments;

						if (args.Count == 1) {
							bag.Obsolete = new ObsoleteAttribute ((string) args[0].Value);
						} else if (args.Count == 2) {
							bag.Obsolete = new ObsoleteAttribute ((string) args[0].Value, (bool) args[1].Value);
						} else {
							bag.Obsolete = new ObsoleteAttribute ();
						}

						continue;
					}

					if (name == "ConditionalAttribute") {
						if (dt.Namespace != "System.Diagnostics")
							continue;

						if (bag == null)
							bag = new AttributesBag ();

						if (conditionals == null)
							conditionals = new List<string> (2);

						conditionals.Add ((string) a.ConstructorArguments[0].Value);
						continue;
					}

					if (name == "CLSCompliantAttribute") {
						if (dt.Namespace != "System")
							continue;

						if (bag == null)
							bag = new AttributesBag ();

						bag.CLSAttributeValue = (bool) a.ConstructorArguments[0].Value;
						continue;
					}

					// Type only attributes
					if (mi.MemberType == MemberTypes.TypeInfo || mi.MemberType == MemberTypes.NestedType) {
						if (name == "DefaultMemberAttribute") {
							if (dt.Namespace != "System.Reflection")
								continue;

							if (bag == null)
								bag = new AttributesBag ();

							bag.DefaultIndexerName = (string) a.ConstructorArguments[0].Value;
							continue;
						}

						if (name == "AttributeUsageAttribute") {
							if (dt.Namespace != "System")
								continue;

							if (bag == null)
								bag = new AttributesBag ();

							bag.AttributeUsage = new AttributeUsageAttribute ((AttributeTargets) a.ConstructorArguments[0].Value);
							foreach (var named in a.NamedArguments) {
								if (named.MemberInfo.Name == "AllowMultiple")
									bag.AttributeUsage.AllowMultiple = (bool) named.TypedValue.Value;
								else if (named.MemberInfo.Name == "Inherited")
									bag.AttributeUsage.Inherited = (bool) named.TypedValue.Value;
							}
							continue;
						}

						// Interface only attribute
						if (name == "CoClassAttribute") {
							if (dt.Namespace != "System.Runtime.InteropServices")
								continue;

							if (bag == null)
								bag = new AttributesBag ();

							bag.CoClass = importer.ImportType ((MetaType) a.ConstructorArguments[0].Value);
							continue;
						}
					}
				}

//.........這裏部分代碼省略.........
開發者ID:Gobiner,項目名稱:ILSpy,代碼行數:101,代碼來源:import.cs

示例10: ImportedMethodDefinition

		public ImportedMethodDefinition (MethodBase provider, AParametersCollection parameters, MetadataImporter importer)
			: base (provider, importer)
		{
			this.parameters = parameters;
		}
開發者ID:litoMalone,項目名稱:mono,代碼行數:5,代碼來源:import.cs

示例11: ImportedModuleDefinition

		//ReflectionMetaImporter metaImporter;
		
		public ImportedModuleDefinition (Module module, MetadataImporter metaImporter)
		{
			this.module = module;
			//this.metaImporter = metaImporter;
		}
開發者ID:telurmasin,項目名稱:mono,代碼行數:7,代碼來源:import.cs

示例12: ImportedMethodDefinition

		public ImportedMethodDefinition (MethodBase provider, TypeSpec type, AParametersCollection parameters, MetadataImporter importer)
			: base (provider, type, parameters, importer)
		{
		}
開發者ID:frje,項目名稱:SharpLang,代碼行數:4,代碼來源:import.cs

示例13: ImportedParameterMemberDefinition

		protected ImportedParameterMemberDefinition (MethodBase provider, TypeSpec type, AParametersCollection parameters, MetadataImporter importer)
			: base (provider, type, importer)
		{
			this.parameters = parameters;
		}
開發者ID:frje,項目名稱:SharpLang,代碼行數:5,代碼來源:import.cs

示例14: ImportedAssemblyDefinition

		public ImportedAssemblyDefinition (Assembly assembly, MetadataImporter importer)
		{
			this.assembly = assembly;
			this.aname = assembly.GetName ();
			this.importer = importer;
		}
開發者ID:wuzzeb,項目名稱:mono,代碼行數:6,代碼來源:import.cs

示例15: ImportedModuleDefinition

		public ImportedModuleDefinition (Module module, MetadataImporter importer)
		{
			this.module = module;
			this.importer = importer;
		}
開發者ID:wuzzeb,項目名稱:mono,代碼行數:5,代碼來源:import.cs


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