Quote:
|
Before they are set to zero there's just random garbage from memory in each of those variables.
|
This is C# we're talking about here. Class variables are initialized to 0 (or null if an object, and false if a boolean) by the CLR when the class is instantiated, so there's never any random garbage in the values. If the programmer manually initializes the values of class variables to 0, the C# compiler will emit the extra instructions to set memory to 0 again, which is inefficient. So it's not wrong, but it's definitely inefficient.