ln.snmp/types/OctetString.cs

39 lines
968 B
C#

// /**
// * File: OctetString.cs
// * Author: haraldwolff
// *
// * This file and it's content is copyrighted by the Author and / or copyright holder.
// * Any use wihtout proper permission is illegal and may lead to legal actions.
// *
// *
// **/
using System;
using System.Text;
namespace ln.snmp.types
{
public class OctetString : Variable
{
public string StringValue { get; set; }
public OctetString()
:base(new Identifier(IdentifierClass.UNIVERSAL, false, 4))
{
}
public OctetString(String text)
:this()
{
StringValue = text;
}
public override byte[] Bytes {
get => Encoding.UTF8.GetBytes(StringValue);
set => StringValue = Encoding.UTF8.GetString(value);
}
public override object Value {
get => StringValue;
set => StringValue = value as string;
}
}
}