বাইট পরিসীমা পরিচালনা করতে, C# এ বাফার টাইপ ব্যবহার করুন। এর পদ্ধতি Buffer.BlockCopy এক বাইট অ্যারে থেকে অন্য বাইট অ্যারেতে বাইট কপি করে।
উদাহরণ
using System;
class Demo {
static void Main() {
// byte arrays
byte[] b1 = new byte[] {39, 45, 58 };
byte[] b2 = new byte[5];
// copying bytes from one to another
Buffer.BlockCopy(b1, 0, b2, 0, 3);
/* calling the method with the byte array b2 that has the copied elements */
bufferFunc(b2);
}
static void bufferFunc(byte[] a) {
for (int j = 0; j < a.Length; j++) {
Console.Write(a[j]);
}
Console.WriteLine();
}
} আউটপুট
39455800