Sub Array from offset - CSharp System

CSharp examples for System:Array Operation

Description

Sub Array from offset

Demo Code


using System;/*from   w w  w . ja  v a2 s . c  om*/

public class Main{
    public static object[] SubArray(this object[] a, int StartElement, int EndElement)
      {
         object[] b = new object[EndElement - StartElement + 1];
         int j = 0;
         for (int i = StartElement; i <= EndElement; i++) {
            b[j] = a[i];
            j += 1;
         }
         return b;
      }
}

Related Tutorials