0
Я читаю значения из PLC теговC# не удалось привести объект типа 'System.Int16 [*], чтобы ввести' System.Int16 []
public void synch_read() //reads device
{
Array values;
Array errors;
object qualities = new object(); //opc server will store the quality of the item
object timestamps = new object(); //store the timestamp of the read
//read directly from device
oGroup.SyncRead((short)OPCAutomation.OPCDataSource.OPCDevice, 2, ref handles, out values, out errors, out qualities, out timestamps);
String abcd = (Int16[])qualities.ToString();
}
В этой строке
String abcd = ((Int16[])qualities).ToString();
Я получаю ошибку
unable to cast object of type 'system.int16[*]' to type 'system.Int16[]'
Как я могу решить эту ошибку?
EDIT
Я попытался
Int16[] abcd = (Int16[2])qualities;
ошибки ; expected
Вы кастинг в строку, затем 'Int16 []', то назначение этого значения в строку ?? – Steve
'((Int16 []) качества) .ToString()' тоже дает ту же ошибку! –
@CarbineCoder, 'dynamic' библиотека нет –