
- 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 GetByte Example in C#
Read individual bytes using GetByte() method in C# −
Set an array −
int[] arr = { 3, 4, 12 };
Now, use Buffer.GetByte() to display the array elements and to read individual bytes −
for (int i = 0; i < Buffer.ByteLength(arr); i++) { Console.WriteLine(Buffer.GetByte(arr, i)); }
The following is the code −
Example
using System; using System.Text; public class Demo { public static void Main() { int[] arr = { 3, 4, 12 }; // loop through the byte array for (int i = 0; i < Buffer.ByteLength(arr); i++) { Console.WriteLine(Buffer.GetByte(arr, i)); } } }
Output
3 0 0 0 4 0 0 0 12 0 0 0
- Related Articles
- Buffer SetByte Example in C#
- Z-Buffer or Depth-Buffer method in C++
- Buffer Type in C#
- Buffer BlockCopy in C#
- Clearing input buffer in C/C++
- A-Buffer Method in C/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
- Polymorphism example in C++

Advertisements