?
Solved

Working with binary data

Posted on 2006-04-27
6
Medium Priority
?
303 Views
Last Modified: 2010-04-16
I'm doing some hard core C#\.NET socket program and have a pressing question about dealing with binary data.  I've done similar work in Java, and have found the ByteBuffer class in Java's NIO package invaluable.  I was wondering if there is a similar class (either part of the .NET SDK or 3rd party) for managing binary data in C#.  The specific operations I would need support for are append, find, cut, and copy, and would want the class to keep track of its current position etc...

If it turns out all I can work with are native .NET arrays, are there any methods for bulk cutting\copying and appending on them?
0
Comment
Question by:derekl
3 Comments
 
LVL 52

Accepted Solution

by:
Carl Tawn earned 336 total points
ID: 16555326
The System.Collections namespace contains a BitArray object which may suit your needs.
0
 
LVL 20

Assisted Solution

by:Daniel Van Der Werken
Daniel Van Der Werken earned 332 total points
ID: 16557932
0
 
LVL 37

Assisted Solution

by:gregoryyoung
gregoryyoung earned 332 total points
ID: 16561413
as for moving data around ... its not as simple as always using blockcopy ..

http://www.eggheadcafe.com/articles/20050325.asp
and
http://geekswithblogs.net/gyoung/archive/2006/04/23/76161.aspx

Given the operations that you mention ... MemoryStream would probably be a good starting point for you.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question