Class OctetString
- Namespace
- Lextm.SharpSnmpLib
- Assembly
- SharpSnmpLib.dll
OctetString type.
public sealed class OctetString : ISnmpData, IEquatable<OctetString>
- Inheritance
-
OctetString
- Implements
- Inherited Members
- Extension Methods
Constructors
OctetString(Levels)
Creates an OctetString with a specific Levels.
public OctetString(Levels level)
Parameters
level
Levels
OctetString(byte[])
Creates an OctetString from raw bytes.
public OctetString(byte[] raw)
Parameters
raw
byte[]Raw bytes
OctetString(string)
Creates an OctetString with a specific string. This string is treated as UTF-16.
public OctetString(string content)
Parameters
content
stringString.
OctetString(string, Encoding)
Creates an OctetString with a specific string. This string is treated in specific Encoding.
public OctetString(string content, Encoding encoding)
Parameters
OctetString(Tuple<int, byte[]>, Stream)
Initializes a new instance of the OctetString class.
public OctetString(Tuple<int, byte[]> length, Stream stream)
Parameters
Properties
DefaultEncoding
Default encoding of OctetString type.
public static Encoding DefaultEncoding { get; set; }
Property Value
Empty
Gets the empty string.
public static OctetString Empty { get; }
Property Value
- OctetString
The empty.
Encoding
Encoding of this OctetString
public Encoding Encoding { get; }
Property Value
TypeCode
Type code.
public SnmpType TypeCode { get; }
Property Value
Methods
AppendBytesTo(Stream)
Appends the bytes to Stream.
public void AppendBytesTo(Stream stream)
Parameters
stream
StreamThe stream.
Equals(OctetString?)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(OctetString? other)
Parameters
other
OctetStringAn object to compare with this object.
Returns
- bool
true if the current object is equal to theother
parameter; otherwise,false .
Equals(object?)
Determines whether the specified object is equal to the current OctetString.
public override bool Equals(object? obj)
Parameters
obj
objectThe object to compare with the current OctetString.
Returns
- bool
true if the specified object is equal to the current OctetString; otherwise,false .
GetHashCode()
Serves as a hash function for a particular type.
public override int GetHashCode()
Returns
- int
A hash code for the current OctetString.
GetRaw()
Gets raw bytes.
public byte[] GetRaw()
Returns
- byte[]
IsNullOrEmpty(OctetString?)
Indicates whether the specified OctetString object is a null reference (Nothing
in Visual Basic) or an Empty string.
public static bool IsNullOrEmpty(OctetString? value)
Parameters
value
OctetStringA OctetString reference.
Returns
- bool
true
if thevalue
parameter is a null reference (Nothing
in Visual Basic) or an empty string (""); otherwise,false
.
ToHexString()
Returns a string in a hex form that represents this OctetString.
public string ToHexString()
Returns
ToLevels()
Returns a Levels that represents this OctetString.
public Levels ToLevels()
Returns
ToPhysicalAddress()
Converts octets to physical address.
public PhysicalAddress ToPhysicalAddress()
Returns
ToString()
Returns a string in UTF-16 that represents this OctetString.
public override string ToString()
Returns
ToString(Encoding)
Returns a string in a specific Encoding that represents this OctetString.
public string ToString(Encoding encoding)
Parameters
encoding
Encoding
Returns
Operators
operator ==(OctetString?, OctetString?)
The equality operator.
public static bool operator ==(OctetString? left, OctetString? right)
Parameters
left
OctetStringLeft OctetString object
right
OctetStringRight OctetString object
Returns
- bool
Returns
true
if the values of its operands are equal,false
otherwise.
operator !=(OctetString?, OctetString?)
The inequality operator.
public static bool operator !=(OctetString? left, OctetString? right)
Parameters
left
OctetStringLeft OctetString object
right
OctetStringRight OctetString object
Returns
- bool
Returns
true
if the values of its operands are not equal,false
otherwise.