March 1, 2011

Initializing Arrays

Today I have found for me new method how I can initialize my array. The point of the matter is that user can skip type in right part. For example:
int[] i = new[] { 0, 1, 2 };
Here we can see that int in right part is skipped. As for me this is interesting.. I had been happened to come across this code after "R#" refactored my code..

Also there are two well known method how array could be initialized:
int[] ii = new int[] { 0, 1, 2 };
int[] iii = { 0, 1, 2 };
p.s. live and learn!

No comments:

Post a Comment