예제 #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));
        }
예제 #2
0
 public void Generate(GeneratedFileUniqueNamer namer)
 {
     codeWriter.AppendLine("#nullable enable");
     GenerateCodeForClass();
     codeWriter.PublishCodeInFile(namer.CreateFileName(ClassName()));
 }