Advertisement
elena1234

Resize Array

Dec 4th, 2021
984
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.39 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3.  
  4. namespace TopTwoNumbers
  5. {
  6.     class Program
  7.     {
  8.         static void Main(string[] args)
  9.         {
  10.             var array1 = new byte[] { 1, 2, 3, 4, 5 };
  11.             Array.Resize<byte>(ref array1, 20);
  12.             int[] bytesAsInts = Array.ConvertAll(array1, c => (int)c);
  13.             Console.WriteLine(string.Join(" ", bytesAsInts));
  14.         }
  15.     }
  16. }
  17.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement