Skip to content

aimenux/SourceGeneratorsDemo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

.NET 5.0

SourceGeneratorsDemo

Playing with source generators (net 5.0 feature)

In this demo, i m building some source generators.

  • Example1.HelloWorldGenerator : a basic source generator saying hello, the source code is retrieved from an internal string field.
  • Example2.HelloWorldGenerator : a basic source generator saying hello, the source code is retrieved from an external textual file.
  • Example3.DiagnosticGenerator : a source generator displaying diagnostics like infos, warnings or errors at compilation time.
  • Example4.IsPrimeGenerator : a source generator adding a dummy extension method to check if a number is prime or not.
  • Example5.BuilderGenerator : a source generator adding a dummy builder to public classes decorated with some attribute.
  • Example6.ToStringGenerator : a source generator adding ToString method to partial classes decorated with some attribute.

⚙️ In order to debug source generators, set isDebuggingEnabled to true in debug mode.

Tools : vs19, net 5.0

About

Playing with source generators

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages