Using VS 2008 and C#, Refactor->Encapsulate Field doesn't work very well when used on static members. Consider the following code (the prefix m_ indicates an instance member, s_ indicates a static member):
internal class MyClass
{
private static int s_nStatic = 0;
private int m_nInstance = 0;
public static void SomeFunc ()
{
// ...
}
}
If you right-click the red s_nStatic symbol, the generated property looks like this:
public int S_nStatic
{
get { return ( s_nStatic ); }
set { s_nStatic = value; }
}
Notice how the property name includes the s_n prefix. When using Refactor->Encapsulate Field on instance fields, such prefixes are removed. If I try the same on the m_nInstance symbol the property is named correctly:
public int Instance
{
get { return ( m_nInstance ); }
set { m_nInstance = value; }
}
I'd expect both to create the property similarly (how the instance-member property is generated, that is, no prefix).