如何使用 BaseListSyntax,Roslyn [英] How to work with BaseListSyntax, Roslyn
本文介绍了如何使用 BaseListSyntax,Roslyn的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
需要使用 roslyn 将继承添加到某些界面.
我描述了这个类,但不知道如何在以下结构中设置继承:
Need to add inherite to some interface using roslyn.
I describe the class, but don't know how to set inherite in the following structures:
ClassDeclarationSyntax lClassDeclarationSyntax =
Syntax.ClassDeclaration(
Syntax.List<AttributeListSyntax>(lAttributeListSyntax),
Syntax.TokenList(lTokens),
Syntax.Identifier(_classInfo.Identifier.ValueText),
null,
null,---------
Syntax.List<TypeParameterConstraintClauseSyntax>(),
Syntax.List<MemberDeclarationSyntax>(lMemberDeclarationSyntaxList));
Isolated "null" 它是按 BaseListSyntax 类型的 List 属性的地方,我可以在其中指定继承接口的名称.
我该怎么做?
Isolated "null" it is a place for List attributes by type BaseListSyntax, where i can specify the name of the inherited interface.
How i can do this?
推荐答案
使用类似:Syntax.BaseList(Syntax.ParseTypeName("MyBaseType")
代替 null
代码> 以上.
Use something like: Syntax.BaseList(Syntax.ParseTypeName("MyBaseType")
in place of the null
above.
这篇关于如何使用 BaseListSyntax,Roslyn的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文