Mutable byte implementation class

Namespace: SnmpSharpNet
Assembly: SnmpSharpNet (in SnmpSharpNet.dll) Version: (0.9.1)


public class MutableByte : ICloneable, 
	IComparable<MutableByte>, IComparable<byte[]>
Visual Basic
Public Class MutableByte _
	Implements ICloneable, IComparable(Of MutableByte),  _
	IComparable(Of Byte())
Visual C++
public ref class MutableByte : ICloneable, 
	IComparable<MutableByte^>, IComparable<array<unsigned char>^>


Mutable byte class allows for manipulation of a byte array with operations like append, prepend. Functionality is implemented through temporary buffer creation and data duplication.
MutableByte buffer = new MutableByte();
buffer += "test data";
buffer.Append(". More test data");
buffer.Prepend("This is ");
Console.WriteLine(buffer.ToString()); // Prints out "This is test data. More test data"
buffer.RemoveBeginning(8); // The buffer now holds "test data. More test data"
buffer.Prepend("It could be "); // buffer is "It could be test data. More test data"
buffer.RemoveEnd(" More test data".Length); // buffer: "It could be test data."
buffer.Remove(12,5); // buffer: "It could be data"
Console.WriteLine("{0}",Convert.ToChar(buffer[1])); // Output: "t"
byte[] tmpBuffer = buffer; // Implicit conversion to byte[]
buffer.Reset(); // Erase all the data from the buffer

Inheritance Hierarchy


See Also