
- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
C# program to count number of bytes in an array
Set a byte array −
byte[] b = { 5, 9, 19, 23, 29, 35, 55, 78 };
To count number of bytes −
Buffer.ByteLength(b)
The following is the code −
Example
using System; class Program { static void Main() { byte[] b = { 5, 9, 19, 23, 29, 35, 55, 78 }; int len = Buffer.ByteLength(b); for (int i = 0; i < len; i++) { Console.WriteLine(b[i]); } Console.WriteLine("Length of byte array = "+len); } }
Output
5 9 19 23 29 35 55 78 Length of byte array = 8
- Related Questions & Answers
- 8085 program to add two consecutive bytes of an array
- 8085 program to subtract two consecutive bytes of an array
- Count number of primes in an array in C++
- C++ Program to Count Inversion in an Array
- Java Program to get the Characters in a String as an Array of Bytes
- C# program to copy a range of bytes from one array to another
- Count number of even and odd elements in an array in C++
- Count number of elements in an array with MongoDB?
- Java Program to Count Number of Digits in an Integer
- Get the number of bytes in a file in C#
- Count the number of items in an array in MongoDB?
- C/C++ Program to Count Inversions in an array using Merge Sort?
- C++ Program to Generate Random Hexadecimal Bytes
- C# Program to skip a specified number of elements of an array
- Python Program to Count Inversions in an array
Advertisements