Why does it give the error? - C#