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


C# ITypeDefOrRef.ToTypeSig方法代码示例

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


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

示例1: AddInitializeArrayCode

		public void AddInitializeArrayCode(Block block, int start, int numToRemove, ITypeDefOrRef elementType, byte[] data) {
			int index = start;
			block.Replace(index++, numToRemove, Instruction.CreateLdcI4(data.Length / elementType.ToTypeSig().ElementType.GetPrimitiveSize()));
			block.Insert(index++, OpCodes.Newarr.ToInstruction(elementType));
			block.Insert(index++, OpCodes.Dup.ToInstruction());
			block.Insert(index++, OpCodes.Ldtoken.ToInstruction((IField)Create(data)));
			block.Insert(index++, OpCodes.Call.ToInstruction((IMethod)InitializeArrayMethod));
		}
开发者ID:SAD1992,项目名称:justdecompile-plugins,代码行数:8,代码来源:InitializedDataCreator.cs

示例2: ResolveTypeOperand

 private MosaType ResolveTypeOperand(ITypeDefOrRef operand, GenericArgumentResolver resolver)
 {
     return metadata.Loader.GetType(resolver.Resolve(operand.ToTypeSig()));
 }
开发者ID:pacificIT,项目名称:MOSA-Project,代码行数:4,代码来源:MetadataResolver.cs

示例3: ApplyGenerics

 TypeSpec ApplyGenerics(ITypeDefOrRef type, IList<TypeSig> generics)
 {
     ClassOrValueTypeSig typeSig = type.ToTypeSig().ToClassOrValueTypeSig();
     GenericInstSig genericSig = new GenericInstSig(typeSig, generics);
     return new TypeSpecUser(genericSig);
 }
开发者ID:3H54N,项目名称:eazdevirt,代码行数:6,代码来源:Resolver.cs

示例4: GetUnknownValue

		static Value GetUnknownValue(ITypeDefOrRef type) {
			return GetUnknownValue(type.ToTypeSig(false));
		}
开发者ID:SAD1992,项目名称:justdecompile-plugins,代码行数:3,代码来源:InstructionEmulator.cs

示例5: WriteToolTipType

        void WriteToolTipType(ITextOutput output, ITypeDefOrRef type, bool useNamespaces, bool usePrimitiveTypeName = true, IHasCustomAttribute typeAttributes = null)
        {
            var td = type as TypeDef;
            if (td == null && type is TypeRef)
                td = ((TypeRef)type).Resolve();
            if (td == null ||
                td.GenericParameters.Count == 0 ||
                (td.DeclaringType != null && td.DeclaringType.GenericParameters.Count >= td.GenericParameters.Count)) {
                var options = ConvertTypeOptions.IncludeTypeParameterDefinitions;
                if (useNamespaces)
                    options |= ConvertTypeOptions.IncludeNamespace;
                if (!usePrimitiveTypeName)
                    options |= ConvertTypeOptions.DoNotUsePrimitiveTypeNames;
                TypeToString(output, options, type, typeAttributes);
                return;
            }

            var typeSig = type.ToTypeSig();
            WriteRefIfByRef(output, typeSig, typeAttributes as ParamDef);

            int numGenParams = td.GenericParameters.Count;
            if (type.DeclaringType != null) {
                var options = ConvertTypeOptions.IncludeTypeParameterDefinitions;
                if (useNamespaces)
                    options |= ConvertTypeOptions.IncludeNamespace;
                TypeToString(output, options, type.DeclaringType, null);
                output.Write('.', TextTokenType.Operator);
                numGenParams = numGenParams - td.DeclaringType.GenericParameters.Count;
                if (numGenParams < 0)
                    numGenParams = 0;
            }
            else if (useNamespaces && !UTF8String.IsNullOrEmpty(td.Namespace)) {
                foreach (var ns in td.Namespace.String.Split('.')) {
                    output.Write(IdentifierEscaper.Escape(ns), TextTokenType.NamespacePart);
                    output.Write('.', TextTokenType.Operator);
                }
            }

            output.Write(IdentifierEscaper.Escape(RemoveGenericTick(td.Name)), TextTokenHelper.GetTextTokenType(td));
            var genParams = td.GenericParameters.Skip(td.GenericParameters.Count - numGenParams).ToArray();
            WriteToolTipGenerics(output, genParams, TextTokenType.TypeGenericParameter);
        }
开发者ID:se7ensoft,项目名称:dnSpy,代码行数:42,代码来源:CSharpLanguage.cs

示例6: createByRefType

 static ByRefSig createByRefType(ITypeDefOrRef elementType)
 {
     if (elementType == null)
         return null;
     return new ByRefSig(elementType.ToTypeSig());
 }
开发者ID:GodLesZ,项目名称:ConfuserDeobfuscator,代码行数:6,代码来源:MethodStack.cs

示例7: GetArgumentType

		/// <summary>
		/// Returns an argument type
		/// </summary>
		/// <param name="methodSig">Method signature</param>
		/// <param name="declaringType">Declaring type (only needed if it's an instance method)</param>
		/// <returns>The type or <c>null</c> if it doesn't exist</returns>
		public TypeSig GetArgumentType(MethodSig methodSig, ITypeDefOrRef declaringType) {
			if (methodSig == null)
				return null;
			int index = GetParameterIndex();
			if (index == 0 && methodSig.ImplicitThis)
				return declaringType.ToTypeSig();	//TODO: Should be ByRef if value type
			if (methodSig.ImplicitThis)
				index--;
			return methodSig.Params.Get(index, null);
		}
开发者ID:EmilZhou,项目名称:dnlib,代码行数:16,代码来源:Instruction.cs

示例8: WriteType

		void WriteType(ITypeDefOrRef type, bool useNamespaces, bool useTypeKeywords) {
			var td = type as TypeDef;
			if (td == null && type is TypeRef)
				td = ((TypeRef)type).Resolve();
			if (td == null ||
				td.GenericParameters.Count == 0 ||
				(td.DeclaringType != null && td.DeclaringType.GenericParameters.Count >= td.GenericParameters.Count)) {
				var oldFlags = this.flags;
				this.flags &= ~(SimplePrinterFlags.ShowNamespaces | SimplePrinterFlags.ShowTypeKeywords);
				if (useNamespaces)
					this.flags |= SimplePrinterFlags.ShowNamespaces;
				if (useTypeKeywords)
					this.flags |= SimplePrinterFlags.ShowTypeKeywords;
				Write(type);
				this.flags = oldFlags;
				return;
			}

			var typeSig = type.ToTypeSig();

			int numGenParams = td.GenericParameters.Count;
			if (type.DeclaringType != null) {
				var oldFlags = this.flags;
				this.flags &= ~(SimplePrinterFlags.ShowNamespaces | SimplePrinterFlags.ShowTypeKeywords);
				if (useNamespaces)
					this.flags |= SimplePrinterFlags.ShowNamespaces;
				Write(type.DeclaringType);
				this.flags = oldFlags;
				OutputWrite(".", TextTokenKind.Operator);
				numGenParams = numGenParams - td.DeclaringType.GenericParameters.Count;
				if (numGenParams < 0)
					numGenParams = 0;
			}
			else if (useNamespaces && !UTF8String.IsNullOrEmpty(td.Namespace)) {
				foreach (var ns in td.Namespace.String.Split('.')) {
					WriteIdentifier(ns, TextTokenKind.NamespacePart);
					OutputWrite(".", TextTokenKind.Operator);
				}
			}

			WriteIdentifier(RemoveGenericTick(td.Name), TextTokenKindUtils.GetTextTokenType(td));
			WriteToken(type);
			var genParams = td.GenericParameters.Skip(td.GenericParameters.Count - numGenParams).ToArray();
			WriteGenerics(genParams, TextTokenKind.TypeGenericParameter);
		}
开发者ID:GreenDamTan,项目名称:dnSpy,代码行数:45,代码来源:SimpleCSharpPrinter.cs


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