I was just wondering why C# allows me to declare a variable using the var
keyword inside a method
private SomeMethod()
{
var someVariable = 5;
}
but not in global scope
Public partial class SomeClass
{
var someVariable = 5;
public SomeClass()
{
}
}
I've tried googling the question and I can't find any answers.