Getting an error for an undefined variable - C#