Mutable byte implementation class
Namespace:
SnmpSharpNetAssembly: SnmpSharpNet (in SnmpSharpNet.dll) Version: 0.5.2.0 (0.5.2.0)
Syntax
| C# |
|---|
public class MutableByte : ICloneable, IComparable<MutableByte>, IComparable<byte[]> |
| Visual Basic (Declaration) |
|---|
Public Class MutableByte _ Implements ICloneable, IComparable(Of MutableByte), _ IComparable(Of Byte()) |
| Visual C++ |
|---|
public ref class MutableByte : ICloneable, IComparable<MutableByte^>, IComparable<array<unsigned char>^> |
Remarks
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.
CopyC#
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