Copy Single Element Of An array To Another Array Without Using Loop In C# And VB.NET
Simple solution is to use Array.Copy() method. C# Code 1 2 3 int [] sourceArray = {1,2,3,4,5,6,7,8,9,10}; int [] destinationArray = new int [1]; Array.Copy(sourceArray,3,destinationArray,0,1); VB.NET Code 1 2 3 Dim sourceArray As Integer () = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10} Dim destinationArray As Integer () = New Integer (1) {} Array.Copy(sourceArray, 3, destinationArray, 0, 1)