It is an age old debate… we have some fairly good guidelines, but they certainly leave room for improvement. Today at a WinFX API review (for some cool stuff that didn’t make it out in the PDC drop) we had the debate again… Today the APIs look like:
public DateTime GetDisconnectTime();
public TimeSpan GetIdleTime();
public DateTime GetLogonTime();
public SessionStates GetSessionStates();
public WindowsIdentity GetUserInformation();
My knee jerk is to make these properties…
public DateTime DisconnectTime {get; }
public TimeSpan IdleTime {get; }
public DateTime LogonTime {get; }
public SessionStates SessionStates {get; }
public WindowsIdentity UserInformation {get; }
the problem… well, the calls *could* be cross machine…. My worry is if they are cross machine making these guys properties will lead people to write inefficient code (and therefore bring down the wrath of Rico)…
So, my question for you… Based on this very limited data I have given you, what should we do here? Go for properties and hope for the best, or error on the safe side and use methods, something else?
|