} // Read public static unsafe uint Read(this NativeReader reader, uint offset, out Int16Collection values) { values = new Int16Collection(reader, offset); uint count; offset = reader.DecodeUnsigned(offset, out count); offset = checked(offset + count * sizeof(Int16)); return offset; } // Read
/// <summary> /// Reads a short array from the stream. /// </summary> public Int16Collection ReadInt16Array(string fieldName) { bool isNil = false; Int16Collection values = new Int16Collection(); if (BeginField(fieldName, true, out isNil)) { PushNamespace(Namespaces.OpcUaXsd); while (MoveToElement("Int16")) { values.Add(ReadInt16("Int16")); } // check the length. if (m_context.MaxArrayLength > 0 && m_context.MaxArrayLength < values.Count) { throw new ServiceResultException(StatusCodes.BadEncodingLimitsExceeded); } PopNamespace(); EndField(fieldName); return values; } if (isNil) { return null; } return values; }
/// <summary> /// Reads a short array from the stream. /// </summary> public Int16Collection ReadInt16Array(string fieldName) { int length = ReadArrayLength(); if (length == -1) { return null; } Int16Collection values = new Int16Collection(length); for (int ii = 0; ii < length; ii++) { values.Add(ReadInt16(null)); } return values; }
/// <summary> /// Reads a short array from the stream. /// </summary> public Int16Collection ReadInt16Array(string fieldName) { var values = new Int16Collection(); List<object> token = null; if (!ReadArrayField(fieldName, out token)) { return values; } for (int ii = 0; ii < token.Count; ii++) { try { m_stack.Push(token[ii]); values.Add(ReadInt16(null)); } finally { m_stack.Pop(); } } return values; }