It doesn’t “expect static” anything – simply: you aren’t allowed to access this
at this point, and number
is implicitly this.number
. Move the code to a constructor instead:
public Foo()
{
number = "13";
a = Convert.ToString(number);
}
string number;
int a;
2
solved Why method call on class level always expect static parameter?