Bite my bytes

What I learn by day I blog at night - A blog from Microsoft Consultant working from Ljubljana, Slovenia

  Home :: Contact :: Syndication  
  999 Posts :: 7691 Comments :: 235 Trackbacks


Most popular posts


My Projects



Copyright © by David Vidmar
Contact me!
LinkedIn Profile

In version 2.5  ReSharper go lots of new code warning highlights. One of the most annoying is certainly “This method could be made static”. First I didn’t even figure it out why it marks some methods like that and I quickly disabled the warning.

When fiddling with SubText code I was running FxCop tests and i spotted similar warning. But FxCop also gives explanations about it’s warnings:

"Methods which do not access instance data or call instance methods can be marked as static (Shared in VB). After doing so, the compiler will emit non-virtual call sites to these members which will prevent a check at runtime for each call that insures the current object pointer is non-null. This can result in a measurable performance gain for performance-sensitive code. In some cases,the failure to access the current object instance represents a correctness issue."

Good enough for me! It’s back on! I even respect the warning and make most affected methods static. But there are still one problem. I’m not sure that it’s correct to put this warning on event handlers. And I’m not the only one.

Let’s wait and see what happens in 2.5.1!

Posted on Friday, January 12, 2007 12:20 AM | Filed under: Developement |
Comments have been closed on this topic.