✅ Use Roslyn to auto-generate overloads of method
I'm working on some code and the amount of overloads I'm having to write is very quickly getting out of hand. I have a bunch of related functions which are overloaded based on the number of parameters in a provided
I came across a blog post here about source generators in .NET 7, and was curious if I could use similar techniques here to totally omit the need to hand-write all these overloads and leave it to a source generator. However, I've never used anything related to source generators or Roslyn before and would like some guidance. Any help would be appreciated.
(Tagging both intermediate and advanced since I'm not sure what this is considered-- someone let me know)
Action. For example, one of the longer methods looks like:I came across a blog post here about source generators in .NET 7, and was curious if I could use similar techniques here to totally omit the need to hand-write all these overloads and leave it to a source generator. However, I've never used anything related to source generators or Roslyn before and would like some guidance. Any help would be appreciated.
(Tagging both intermediate and advanced since I'm not sure what this is considered-- someone let me know)
Exploring .NET source generators to reduce boilerplate code in everyday code!
