
- C# Basic Tutorial
- C# - Home
- C# - Overview
- C# - Environment
- C# - Program Structure
- C# - Basic Syntax
- C# - Data Types
- C# - Type Conversion
- C# - Variables
- C# - Constants
- C# - Operators
- C# - Decision Making
- C# - Loops
- C# - Encapsulation
- C# - Methods
- C# - Nullables
- C# - Arrays
- C# - Strings
- C# - Structure
- C# - Enums
- C# - Classes
- C# - Inheritance
- C# - Polymorphism
- C# - Operator Overloading
- C# - Interfaces
- C# - Namespaces
- C# - Preprocessor Directives
- C# - Regular Expressions
- C# - Exception Handling
- C# - File I/O
- C# Advanced Tutorial
- C# - Attributes
- C# - Reflection
- C# - Properties
- C# - Indexers
- C# - Delegates
- C# - Events
- C# - Collections
- C# - Generics
- C# - Anonymous Methods
- C# - Unsafe Codes
- C# - Multithreading
- C# Useful Resources
- C# - Questions and Answers
- C# - Quick Guide
- C# - Useful Resources
- C# - Discussion
Buffer Type in C#
To handle range of bytes, use Buffer Type in C#. Its method Buffer.BlockCopy copies the bytes from one byte array to another byte array.
Example
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(); } }
Output
39455800
- Related Articles
- Z-Buffer or Depth-Buffer method in C++
- Buffer BlockCopy in C#
- Clearing input buffer in C/C++
- A-Buffer Method in C/C++?
- Buffer GetByte Example in C#
- Buffer SetByte Example in C#
- What does buffer flush means in C++ ?
- How do I clear the cin buffer in C++?
- What do you mean by buffer in C language?
- Database Buffer in DBMS
- What is a buffer attribute in JSP?
- How to use string buffer in android?
- Convert buffer to readable string in JavaScript?
- Implementing circular queue ring buffer in JavaScript
- Difference between Buffer and Cache

Advertisements