Tuesday, March 15, 2011

FxCop + MVP: "Properties should not be write only"

Suppose I'm implementing an MVP pattern and I have a view interface as such:

interface IView {

    string SuperRadString { set; }
}

There's no reason for the presenter to ever need to retrieve this string from the view, so can I safely ignore this error?

From stackoverflow
  • Well, yes...

    However, semantically it would make more sense to have a method for setting the value than a "black hole property".

  • Well... I think that write only Password properties are OK.

0 comments:

Post a Comment