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


C# ITypeDefOrRef.TryGetByRefSig方法代码示例

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


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

示例1: TypeToString

        string TypeToString(ConvertTypeOptions options, ITypeDefOrRef type, IHasCustomAttribute typeAttributes = null)
        {
            AstType astType = AstBuilder.ConvertType(null, null, type, typeAttributes, options);

            StringWriter w = new StringWriter();
            if (type.TryGetByRefSig() != null) {
                ParamDef pd = typeAttributes as ParamDef;
                if (pd != null && (!pd.IsIn && pd.IsOut))
                    w.Write("out ");
                else
                    w.Write("ref ");

                if (astType is ComposedType && ((ComposedType)astType).PointerRank > 0)
                    ((ComposedType)astType).PointerRank--;
            }

            astType.AcceptVisitor(new CSharpOutputVisitor(w, FormattingOptionsFactory.CreateAllman()));
            return w.ToString();
        }
开发者ID:jorik041,项目名称:dnSpy-retired,代码行数:19,代码来源:CSharpLanguage.cs

示例2: TypeToString

		void TypeToString(ITextOutput output, ConvertTypeOptions options, ITypeDefOrRef type, IHasCustomAttribute typeAttributes = null)
		{
			var envProvider = new ILSpyEnvironmentProvider();
			var converter = new CSharpToVBConverterVisitor(envProvider);
			var astType = AstBuilder.ConvertType(type, typeAttributes, options);

			if (type.TryGetByRefSig() != null) {
				output.Write("ByRef", TextTokenType.Keyword);
				output.WriteSpace();
				if (astType is NRefactory.CSharp.ComposedType && ((NRefactory.CSharp.ComposedType)astType).PointerRank > 0)
					((NRefactory.CSharp.ComposedType)astType).PointerRank--;
			}
			
			var vbAstType = astType.AcceptVisitor(converter, null);
			
			vbAstType.AcceptVisitor(new OutputVisitor(new VBTextOutputFormatter(output), new VBFormattingOptions()), null);
		}
开发者ID:nakijun,项目名称:dnSpy,代码行数:17,代码来源:VBLanguage.cs

示例3: TypeToString

        void TypeToString(ITextOutput output, ConvertTypeOptions options, ITypeDefOrRef type, IHasCustomAttribute typeAttributes = null)
        {
            if (type == null)
                return;
            AstType astType = AstBuilder.ConvertType(type, typeAttributes, options);

            if (WriteRefIfByRef(output, type.TryGetByRefSig(), typeAttributes as ParamDef)) {
                if (astType is ComposedType && ((ComposedType)astType).PointerRank > 0)
                    ((ComposedType)astType).PointerRank--;
            }

            var module = type.Module;
            if (module == null && type is TypeSpec && ((TypeSpec)type).TypeSig.RemovePinnedAndModifiers() is GenericSig) {
                var sig = (GenericSig)((TypeSpec)type).TypeSig.RemovePinnedAndModifiers();
                if (sig.OwnerType != null)
                    module = sig.OwnerType.Module;
                if (module == null && sig.OwnerMethod != null && sig.OwnerMethod.DeclaringType != null)
                    module = sig.OwnerMethod.DeclaringType.Module;
            }
            var ctx = new DecompilerContext(type.Module);
            astType.AcceptVisitor(new CSharpOutputVisitor(new TextTokenWriter(output, ctx), FormattingOptionsFactory.CreateAllman()));
        }
开发者ID:se7ensoft,项目名称:dnSpy,代码行数:22,代码来源:CSharpLanguage.cs

示例4: TypeToString

        string TypeToString(ConvertTypeOptions options, ITypeDefOrRef type, IHasCustomAttribute typeAttributes = null)
        {
            var envProvider = new ILSpyEnvironmentProvider();
            var converter = new CSharpToVBConverterVisitor(envProvider);
            var astType = AstBuilder.ConvertType(null, null, type, typeAttributes, options);
            StringWriter w = new StringWriter();

            if (type.TryGetByRefSig() != null) {
                w.Write("ByRef ");
                if (astType is NRefactory.CSharp.ComposedType && ((NRefactory.CSharp.ComposedType)astType).PointerRank > 0)
                    ((NRefactory.CSharp.ComposedType)astType).PointerRank--;
            }

            var vbAstType = astType.AcceptVisitor(converter, null);

            vbAstType.AcceptVisitor(new OutputVisitor(w, new VBFormattingOptions()), null);
            return w.ToString();
        }
开发者ID:jorik041,项目名称:dnSpy-retired,代码行数:18,代码来源:VBLanguage.cs


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