Its just bad programming!
Say you finished working on your program and then a month later you want to come back and add another features. But you accidentally used in that global variable inside your new class.
Now it changes stuff in another classes that your don't want to change. And you have many more bugs and you have no idea where to begin because you didn't touch the code for a month.
And one more thing about the ref
word - one of its goals is to force your initialize the variable before you return it. That way the compiler makes sure that you don't use variable containing garbage which will crush the code.
When you use a global variable you can use in that uninitialized global variable and you'll get an exception.
So if you know when and how to use ref
and out
- use them.
And don't EVER use global variable. bad programming.
Good luck!