public static ItemData <object> ReadValueEx(this IReaderWriter reader, DeviceAddress address) { switch (address.VarType) { case DataType.BOOL: var bit = reader.ReadBit(address); return(new ItemData <object>(bit.Value, bit.TimeStamp, bit.Quality)); case DataType.BYTE: var bt = reader.ReadByte(address); return(new ItemData <object>(bt.Value, bt.TimeStamp, bt.Quality)); case DataType.WORD: var ush = reader.ReadUInt16(address); return(new ItemData <object>(ush.Value, ush.TimeStamp, ush.Quality)); case DataType.SHORT: var sh = reader.ReadInt16(address); return(new ItemData <object>(sh.Value, sh.TimeStamp, sh.Quality)); case DataType.DWORD: var dw = reader.ReadUInt32(address); return(new ItemData <object>(dw.Value, dw.TimeStamp, dw.Quality)); case DataType.INT: var it = reader.ReadInt32(address); return(new ItemData <object>(it.Value, it.TimeStamp, it.Quality)); case DataType.FLOAT: var fl = reader.ReadFloat(address); return(new ItemData <object>(fl.Value, fl.TimeStamp, fl.Quality)); case DataType.STR: var str = reader.ReadString(address, address.DataSize); return(new ItemData <object>(str.Value, str.TimeStamp, str.Quality)); } return(new ItemData <object>(null, 0, QUALITIES.QUALITY_BAD)); }