The Active Network
ActiveMac Anonymous | Create a User | Reviews | News | Forums | Advertise  
 

  *  

  Properites vs. Methods...
Time: 19:17 EST/00:17 GMT | News Source: GotDotNet | Posted By: Jonathan Tigner

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?

Write Comment
Return to News

  Displaying 751 through 752 of 752
Prev | First
  The time now is 3:02:37 PM ET.
Any comment problems? E-mail us
#751 By 4240821 (82.115.4.100) at 1/6/2026 4:42:45 AM
https://www.pillowfort.social/posts/6558311
https://www.pillowfort.social/posts/6558105
https://www.pillowfort.social/posts/6558022
https://www.pillowfort.social/posts/6557957
https://www.pillowfort.social/posts/6557830
https://www.pillowfort.social/posts/6557649
https://www.pillowfort.social/posts/6557474
https://www.pillowfort.social/posts/6557261
https://www.pillowfort.social/posts/6557070
https://www.pillowfort.social/posts/6556926

#752 By 4240821 (82.115.4.100) at 1/6/2026 2:39:45 PM
https://www.pillowfort.social/posts/6565219
https://www.pillowfort.social/posts/6565121
https://www.pillowfort.social/posts/6565027
https://www.pillowfort.social/posts/6564918
https://www.pillowfort.social/posts/6564758
https://www.pillowfort.social/posts/6564643
https://www.pillowfort.social/posts/6564496
https://www.pillowfort.social/posts/6564408
https://www.pillowfort.social/posts/6564283
https://www.pillowfort.social/posts/6564204

Write Comment
Return to News
  Displaying 751 through 752 of 752
Prev | First
  The time now is 3:02:37 PM ET.
Any comment problems? E-mail us
User name and password:

 

  *  
  *   *