Skip to main content

Roslyn checkpoint

Challenge on lesson: Checkpoint: Roslyn

CHALLENGE
Difficulty: advanced+25 XP

Implement static string[] PublicMethodNames(string source): parse source with CSharpSyntaxTree.ParseText, find all MethodDeclarationSyntax nodes, and return their identifiers sorted. Then implement static bool Compiles(string source): build a CSharpCompilation (OutputKind.DynamicallyLinkedLibrary) over that source with the references from AppDomain.CurrentDomain.GetAssemblies() filtered to IsDynamic == false && Location != string.Empty, and return it has zero error diagnostics.

Back to lesson: Checkpoint: Roslyn