what is the difference between field and a variable?
what is the diff between a field and a variable?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
VulpesPosted Apr 7, 2013, 10:51 AM
This contrasts with a local variable which is only visible within the block in which it is defined. This block may either be an entire method or property or only part of it such as a loop statement.
For example:
class MyClass
{
public int MyInt; // this is a field or class level variable
public void MyMethod()
{
int i = 3; // this is a local variable
Console.WriteLine(i);
}
}