Consider the following class:
public class Extractor
{
public IService service;
public Extractor(IService service)
{
this.service = service;
}
public void DoSth()
{
var sampleMethodInfo = this.service.GetMethodInfo();
var version = ExtractAvailableMethodVersion(sampleMethodInfo);
// other stuff
}
private int ExtractAvailableMethodVersion(MethodInfo methodInfo)
{
var regex = new Regex(MIGRATION_METHD_NAME_EXTRACT_VERSION);
var matcher = regex.Match(methodInfo.Name);
return Convert.ToInt32(matcher.Groups[1].Value);
}
}
Resharper hints to make ExtractAvailableMethodVersion
static. So my question is - should I make static method everywhere it's possible (like in the example ablove)? Is any performance difference when calling static / non-static method in such a case? Or is it only "code-style rule" to make static method when not using instance members?