inotifypropertychanged - Suppress "Member is never assigned to" warning in C# -
i have next code:
viewportviewmodel _trochoid; public viewportviewmodel trochoid { { homecoming _trochoid; } set { this.raiseandsetifchanged(value); } }
using reactiveui inpc support. compiler warning me trochoid
never assigned , null. due magic raiseandsetifchanged
performs through callermembername
support, code work , compiler wrong.
how cleanly suppress these warnings in code?
how cleanly suppress these warnings in code
an alternative inappropriate assignment #pragma
:
#pragma warning disable 0649 // assigned reflection viewportviewmodel _trochoid; #pragma warning restore 0649
that should work, , keeps ugliness @ place makes sense document - @ field declaration.
if have multiple fields handled in same way, set them in same "block" of disabled warnings, comment applicable of them.
whether view "clean" or not matter of taste, of course. think prefer assignments there side-effect of removing warnings.
c# inotifypropertychanged suppress-warnings reactiveui callermembername
No comments:
Post a Comment