Skip to content
Discussion options

You must be logged in to vote

Is there a language question here? Writing code like that isn't unique to C# or these use cases, you do need to be careful. You mitigate the danger through many means, such as just having good unit tests. You could also use analyzers to detect when you've missed a field, or source generators to emit the operators for you. You could also use reflection and expression trees combined into a delegate, which would give you a performance hit up front but wouldn't be appreciably slower from that point on.

Replies: 3 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by zms9110750
Comment options

You must be logged in to vote
2 replies
@zms9110750
Comment options

@theunrepentantgeek
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
5 participants