When a variable is declared, the compiler will give the variable a default value.
Such as When I declare like this “ int i;” , the compiler will give 0 to “ i“
So In the IL code is there any difference between “ int i;” and “ int i=0”
If there is no difference between them, is there any other method to get the difference

Help me!!!
Alex Banks
int i = 0; is actually a slight performance hit compared to int i; reason being that int i = 0; will allocate space on the heap and then it will apply the value of zero to the allocated memory. int i; will allocate the memory, and by default the value will return 0 until changed.
to answer your question, I'm 99% sure that the IL retains the assignment (as it doesn't know to determine the difference between 0, 1, 10, 20 or any other number - all it knows is that an assignment is being made).
Raja Pratap
If you are looking at the differences in the IL code though, are you looking at the output with debug or optimized
If you are interested in looking for occurences of unnecessary initialization, you can use FxCop, which is available as part of Visual Studio Team Edition for Developers and Visual Studio Team Suite. Also available via download from http://www.gotdotnet.com.
For additional information on this rule see: http://msdn2.microsoft.com/en-us/library/ms182274(VS.80).aspx
Esenthel
I wasn't aware that there was no difference in the IL code. I was sure there was. I can't say that i would be able to tell you how to determine whether a developer has set it or not - it's not something that i've ever had the need to do yet.
If you find an answer on this i'd like to know what happens. Sorry i don't actually know an answer on this one.
Hassan Ghaed
So as your option, you mean you can determine whether a value is assigned to a variable when it is defined
Then how to determine whether a value is assigned to a variable by the programmer when it is defined or it is assigned by the compiler
But there are not differences between “ int i;” and “ int i=0” In the IL code.