Create Byte Array - CSharp System

CSharp examples for System:Byte Array

Description

Create Byte Array

Demo Code

// Copyright (c) Microsoft. All rights reserved.
using System.Collections.Generic;

public class Main{
        public static byte[] CreateByteArray(long length, byte value)
        {// w w w .  j ava  2s .  c  o m
            var data = new byte[length];
            for (int index = 0; index < length; index++)
            {
                data[index] = value;
            }
            return data;
        }
        public static byte[] CreateByteArray(long length)
        {
            var random = new Random(100);
            var data = new byte[length];
            random.NextBytes(data);
            return data;
        }
}

Related Tutorials