DEV Community

Discussion on: Bending DateTime in .NET to Test Your Code Better

Collapse
 
stphnwlsh profile image
Stephen Walsh

Yeah sorry, not everything is earth shattering. I'm interested in your source generators solution though.

Collapse
 
ramenturismo profile image
Emy F. (She/Her)

I just meant what you just said : A earth shattering solution. Did not meant as an offense. I'm glad this kind of article exists because I've seen a lot of dev not taking this into account, so thank you!

BTW; I don't think SourceGenerators are meant for this, although we could achieve this by generating a property with the interface you created there, but it would go against constructor injection.
I never used Source Generators, could be interesting to dig into this (Found a "cookbook").

Thread Thread
 
stphnwlsh profile image
Stephen Walsh

Haha just read my comment back, reads a little snarky to me....sorry about that.

As for source generators, your comment got me thinking about how I could use them. Pretty sure they wouldn't work well for something like this but loads of other applications. Thanks for making me ponder something new!!!