Is there a way to find out whether class is partial
inside Roslyn analyzer?
There is a PartialImplementationPart
in IMethodSymbol
, but nothing similar for INamedTypeSymbol
.
I'm writing a Source Generator, and I want to generate second part of the class only if it's possible (if first part is partial).
You could use the Modifier List to check if the class is partial.
var isPartial = classDeclaration.Modifiers
.Any(m => m.IsKind(SyntaxKind.PartialKeyword));