12.5. Using the System.Array class

I mentioned that all array objects in C# are implicitly objects of the System.Array class. System.Array contains useful methods and properties which you can use. The Length property, [8] discussed earlier, is actually inherited from System.Array. Other methods can be used for creating, manipulating, searching, and sorting arrays.

[8] If you are not sure of C# properties, just treat a property as a public field for now. See Chapter 20 for more information.

I shall introduce the following static methods in System.Array which can be useful for 1D arrays:

  • public static void Reverse (Array array)

  • public static void Sort (Array array)

  • public static int IndexOf (Array array, Object value)

Check out the API documentation ...

Get From Java to C#: A Developer's Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.