ReSharper complains when method can be static, but isn’t

I find that comment very useful as it points out two important things:

  1. It makes me ask myself if the method
    in question should actually be part
    of the type or not. Since it doesn’t use
    any instance data, you should at
    least consider if it could be moved
    to its own type. Is it an integral part
    of the type, or is it really a general
    purpose utility method?

  2. If it does make sense to keep the
    method on the specific type, there’s
    a potential performance gain as the
    compiler will emit different code
    for a static method.

Leave a Comment