"Generator Source Project With Partial Method"

[Generator]
public class MySourceGenerator : ISourceGenerator {
	const string ExampleSource = @"
		namespace GeneratorTarget {
			public static partial class GeneratedClass {
				public static partial int GetInt() => 123;
			}
		}";

	public void Execute(GeneratorExecutionContext context) {
		context.AddSource("Generated.cs", ExampleSource);
	}

	public void Initialize(GeneratorInitializationContext context) {
		/* do nothing */
	}
}


Code snippet taken from "Two Decades of C#: A Reference - C# 9".