//methods private Variant ReadValue(IBinaryDecoder encoder, BuiltInType encodingByte) { switch (encodingByte) { case BuiltInType.Boolean: return(new Variant(encoder.ReadBoolean(), encodingByte)); case BuiltInType.SByte: return(new Variant(encoder.ReadSByte(), encodingByte)); case BuiltInType.Byte: return(new Variant(encoder.ReadByte(), encodingByte)); case BuiltInType.Int16: return(new Variant(encoder.ReadInt16(), encodingByte)); case BuiltInType.UInt16: return(new Variant(encoder.ReadUInt16(), encodingByte)); case BuiltInType.Int32: case BuiltInType.Enumeration: return(new Variant(encoder.ReadInt32(), encodingByte)); case BuiltInType.UInt32: return(new Variant(encoder.ReadUInt32(), encodingByte)); case BuiltInType.Int64: return(new Variant(encoder.ReadInt64(), encodingByte)); case BuiltInType.UInt64: return(new Variant(encoder.ReadUInt64(), encodingByte)); case BuiltInType.Float: return(new Variant(encoder.ReadSingle(), encodingByte)); case BuiltInType.Double: return(new Variant(encoder.ReadDouble(), encodingByte)); case BuiltInType.String: return(new Variant(ReadString(encoder), encodingByte)); case BuiltInType.DateTime: return(new Variant(ReadDateTime(encoder), encodingByte)); case BuiltInType.Guid: return(new Variant(ReadGuid(encoder), encodingByte)); case BuiltInType.ByteString: return(new Variant(ReadByteString(encoder), encodingByte)); case BuiltInType.XmlElement: return(new Variant(ReadXmlElement(encoder), encodingByte)); case BuiltInType.NodeId: return(new Variant(ReadNodeId(encoder), encodingByte)); case BuiltInType.ExpandedNodeId: return(new Variant(ReadExpandedNodeId(encoder), encodingByte)); case BuiltInType.StatusCode: return(new Variant(ReadStatusCode(encoder), encodingByte)); case BuiltInType.QualifiedName: return(new Variant(ReadQualifiedName(encoder), encodingByte)); case BuiltInType.LocalizedText: return(new Variant(ReadLocalizedText(encoder), encodingByte)); case BuiltInType.ExtensionObject: return(new Variant(ReadExtensionObject(encoder), encodingByte)); case BuiltInType.DataValue: return(new Variant(ReadDataValue(encoder), encodingByte)); default: throw new ArgumentOutOfRangeException($"Cannot decode unknown type in Variant object (0x{encodingByte:X})."); } }