Array Class and Implicit array in csharp

Array Class : In our Base class library we are provided with class array under the System namespace which contains a set of methods in it and by calling these methods we can perform actions on an array object.

     System.Array

  • Sort (Array arr)//method
  • Reverse(Array arr)//method
  • Copy(Array src, Array dst ,int n)//method
  • Getlength(int index)//method
  • Length //Property

Implicit Type Arrays : Just like we can declare variable using Var keyword we can also declare arrays by using the var keyword so that the data type of array is identify based on the value assigned to that array.

Example :

var iarr = new [] {10, 20, 40,};
var sarr = new [] {"Red", "Blue", "Green"};

No comments:

Post a Comment