当前位置: 首页>>代码示例>>C#>>正文


C# TypeReference.GetFullName方法代码示例

本文整理汇总了C#中Mono.Cecil.TypeReference.GetFullName方法的典型用法代码示例。如果您正苦于以下问题:C# TypeReference.GetFullName方法的具体用法?C# TypeReference.GetFullName怎么用?C# TypeReference.GetFullName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mono.Cecil.TypeReference的用法示例。


在下文中一共展示了TypeReference.GetFullName方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetTypeDefinition

		public TypeDefinition GetTypeDefinition (TypeReference type)
		{
			if (type == null)
				return null;

			TypeDefinition typeDef = type as TypeDefinition;
			if (typeDef != null)
				return typeDef;

			AssemblyNameReference name = type.Scope as AssemblyNameReference;
			if (name == null) {
				GenericInstanceType gi = type as GenericInstanceType;
				return gi == null ? null : GetTypeDefinition (gi.ElementType);
			}

			AssemblyDefinition assmDef;
			try {
				assmDef = Resolve (name);
			} catch (FileNotFoundException) {
				throw new ObfuscarException ("Unable to resolve dependency:  " + name.Name);
			}

			string fullName = type.GetFullName ();
			typeDef = assmDef.MainModule.GetType (fullName);
			return typeDef;
		}
开发者ID:jerryhuffman,项目名称:obfuscar,代码行数:26,代码来源:AssemblyCache.cs

示例2: GetTypeDefinition

		public TypeDefinition GetTypeDefinition (TypeReference type)
		{
			if (type == null)
				return null;

			TypeDefinition typeDef = type as TypeDefinition;
			if (typeDef != null)
				return typeDef;

			AssemblyNameReference name = type.Scope as AssemblyNameReference;
			if (name == null) {
				GenericInstanceType gi = type as GenericInstanceType;
				return gi == null ? null : GetTypeDefinition (gi.ElementType);
			}

			AssemblyDefinition assmDef;
			try {
				assmDef = Resolve (name);
			} catch (FileNotFoundException) {
				throw new ObfuscarException ("Unable to resolve dependency:  " + name.Name);
			}

			string fullName = type.GetFullName ();
			typeDef = assmDef.MainModule.GetType (fullName);
			if (typeDef != null)
				return typeDef;

			// IMPORTANT: handle type forwarding
			if (!assmDef.MainModule.HasExportedTypes)
				return null;

			foreach (var exported in assmDef.MainModule.ExportedTypes) {
				if (exported.FullName == fullName)
					return exported.Resolve ();
			}

			return null;
		}
开发者ID:alexchicn,项目名称:obfuscar,代码行数:38,代码来源:AssemblyCache.cs

示例3: GetMethods

		private void GetMethods (TypeReference type)	
		{
			string full_name = type.GetFullName ();
			args1 [0] = full_name;
			AddMethod (type.GetMethod (MethodSignatures.Equals));
			AddMethod (type.GetMethod ("Equals", "System.Boolean", args1));

			AddMethod (type.GetMethod ("CompareTo", "System.Int32", args1));	// generic version
			AddMethod (type.GetMethod (CompareTo));								// non-generic version

			// Note that we don't want to use MethodSignatures for these 
			// because we don't want any weird overloads.
			args2 [0] = full_name;
			args2 [1] = full_name;
			AddMethod (type.GetMethod ("op_Equality", "System.Boolean", args2));	
			AddMethod (type.GetMethod ("op_Inequality", "System.Boolean", args2));

			AddMethod (type.GetMethod ("op_LessThan", "System.Boolean", args2));
			AddMethod (type.GetMethod ("op_LessThanOrEqual", "System.Boolean", args2));
			AddMethod (type.GetMethod ("op_GreaterThan", "System.Boolean", args2));
			AddMethod (type.GetMethod ("op_GreaterThanOrEqual", "System.Boolean", args2));
			
			clone.Method = type.GetMethod (MethodSignatures.Clone);
			hash.Method = type.GetMethod (MethodSignatures.GetHashCode);
		}
开发者ID:FreeBSD-DotNet,项目名称:mono-tools,代码行数:25,代码来源:ReviewInconsistentIdentityRule.cs

示例4: IsRule

		private bool IsRule (TypeReference type)
		{
			var typeName = type.GetFullName ();
			bool result;
			if (!typeIsRule.TryGetValue (typeName, out result)) {
				result = type.Implements ("Gendarme.Framework", "IRule");
				typeIsRule [typeName] = result;
			}
			return result;
		}
开发者ID:alfredodev,项目名称:mono-tools,代码行数:10,代码来源:ReviewAttributesOnRulesRule.cs

示例5: AppendPrettyTypeName

        private static void AppendPrettyTypeName(StringBuilder sb, TypeReference type)
        {
            int nRemoveTrail;
            IList<GenericParameter> gpc = type.GenericParameters;
            int count = gpc.Count;
            if (count == 0)
                nRemoveTrail = 0;
            else if (count < 10)
                nRemoveTrail = 2;
            else
                nRemoveTrail = 3;

            string fullname = type.GetFullName ();
            sb.Append (fullname.Substring (0, fullname.Length - nRemoveTrail));
            if (count > 0) {
                int n = 0;
                sb.Append ("<");
                foreach (GenericParameter gp in gpc) {
                    if (n > 0)
                        sb.Append (",");
                    AppendPrettyTypeName (sb, gp);
                    n++;
                }
                sb.Append (">");
            }
        }
开发者ID:alfredodev,项目名称:mono-tools,代码行数:26,代码来源:AvoidUnnecessarySpecializationRule.cs

示例6: InheritFromWeakType

		static string InheritFromWeakType (TypeReference type, string nameSpace, string name)
		{
			if (!type.Inherits (nameSpace, name))
				return String.Empty;
			return String.Format (CultureInfo.InvariantCulture, "'{0}' inherits from '{1}.{2}'.", 
				type.GetFullName (), nameSpace, name);
		}
开发者ID:FreeBSD-DotNet,项目名称:mono-tools,代码行数:7,代码来源:DoNotLockOnWeakIdentityObjectsRule.cs


注:本文中的Mono.Cecil.TypeReference.GetFullName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。