Resharper attribute to disable warnings “never assigned” but not “never used”

I have a factory that creates objects and populates fields marked with a special attribute. Resharper places a green underline under these fields, complaining that the "Field" Example "is never assigned." To suppress the warning, I can add MeansImplicitUseAttribute to my custom attribute. The problem is that the attribute also suppresses the warning "Field" Example never used is used ", which is useful to me, so I would like to keep it.

Is it possible to mark my attribute in such a way that I do not receive a warning “never assigned”, but I still get “never used”?

+4
source share
1 answer

Oh, there are MeansImplicitUse attribute attributes that indicate the type of use, so I really want to add [MeansImplicitUse(ImplicitUseKindFlags.Assign)] in my attribute definition. Plain!

+3
source

Source: https://habr.com/ru/post/1502520/


All Articles