Exemple #1
0
        public string DoSomethingWithTheSyntaxTree(SyntaxTree syntaxTree)
        {
            ICSharpVersionDependent csharpVersionDependent = CSharpVersionDependentCreator.GetCSharpVersionDependentImplementation();

            var versionDependentOutput = csharpVersionDependent.DoSomethngWithNullableReferenceTypes(syntaxTree);

            return
                ("Assembly location:" +
                 Environment.NewLine +
                 syntaxTree.GetType().Assembly.Location +
                 Environment.NewLine +
                 "Assembly name and version:" +
                 Environment.NewLine +
                 syntaxTree.GetType().Assembly +
                 Environment.NewLine +
                 $"Number of {nameof(SyntaxNode)} types:" +
                 Environment.NewLine +
                 syntaxTree.GetType().Assembly
                 .ExportedTypes
                 .Count(type => typeof(SyntaxNode).IsAssignableFrom(type)) +
                 Environment.NewLine +
                 $"Number of {nameof(SyntaxKind)} entries:" +
                 Environment.NewLine +
                 Enum.GetValues(typeof(SyntaxKind)).Length +
                 Environment.NewLine +
                 $"Doing something with nullable reference types:" +
                 Environment.NewLine +
                 versionDependentOutput +
                 Environment.NewLine);
        }
 public static ICSharpVersionDependent GetCSharpVersionDependentImplementation()
 {
     return(instance = instance ?? CreateCSharpVersionDependentImplementation());
 }