How to work with BaseListSyntax, Roslyn

自作多情 提交于 2019-12-11 11:49:26

问题


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" 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?


回答1:


Use something like: Syntax.BaseList(Syntax.ParseTypeName("MyBaseType") in place of the null above.



来源:https://stackoverflow.com/questions/21833273/how-to-work-with-baselistsyntax-roslyn

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!