Software/C#.Net
Understanding C# Arrays
charom
2011. 5. 15. 02:52
MSDN
C# Array Initialization Syntax
Initialization of C# Array .... // Array initialization syntax using the new keyword. string[] stringArray = new string[] { "one", "two", "three" }; Console.WriteLine("stringArray has {0} elements", stringArray.Length); // Array initialization syntax without using the new keyword. bool[] boolArray = { false, false, true }; Console.WriteLine("boolArray has {0} elements", boolArray.Length); // Array initialization with new keyword and size. int[] intArray = new int[4] { 20, 22, 23, 0 }; Console.WriteLine("intArray has {0} elements", intArray.Length);Considerable methods of Array Class
Member of Array Class Meaning in Life ------------------------------------------------------------------------------------------------------ Clear() This static method sets a range of elements in the array to empty values (0 for numbers, null for object references, false for booleans). CopyTo() This method is used to copy elements from the source array into the destination array. Length This property returns the number of items within the array. Rank This property returns the number of dimensions of the current array. Reverse() This static method reverses the contents of an one-dimensional array. Sort() This static method sorts a one-dimensional array of intrinsic types. If the elements in the array implement the IComparer interface, you can also sort your custom types