本文整理汇总了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();
}
示例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);
}
示例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()));
}
示例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();
}