Example #1
0
        private void TryGenerateCode(
            string proposedNamePrefix,
            GeneratorExecutionContext context,
            Func <CodeWriter, bool> contentFunc)
        {
            var codeWriter = new CodeWriter(context);

            if (!contentFunc(codeWriter))
            {
                return;                           // no code to generate
            }
            codeWriter.PublishCodeInFile(namer.CreateFileName(proposedNamePrefix));
        }
 public void Generate(GeneratedFileUniqueNamer namer)
 {
     codeWriter.AppendLine("#nullable enable");
     GenerateCodeForClass();
     codeWriter.PublishCodeInFile(namer.CreateFileName(ClassName()));
 }