} // Read public static unsafe uint Read(this NativeReader reader, uint offset, out UInt64Collection values) { values = new UInt64Collection(reader, offset); uint count; offset = reader.DecodeUnsigned(offset, out count); offset = checked (offset + count * sizeof(UInt64)); return(offset); } // Read
public static ulong[] ToArray(this UInt64Collection collection, Type enumType = null) { int count = collection.Count; ulong[] result; if (enumType != null) { Debug.Assert(enumType.IsEnum); result = (ulong[])Array.CreateInstance(enumType, count); } else { result = new ulong[count]; } int i = 0; foreach (ulong element in collection) { result[i++] = element; } Debug.Assert(i == count); return(result); }
/// <summary> /// Reads a ulong array from the stream. /// </summary> public UInt64Collection ReadUInt64Array(string fieldName) { bool isNil = false; UInt64Collection values = new UInt64Collection(); if (BeginField(fieldName, true, out isNil)) { PushNamespace(Namespaces.OpcUaXsd); while (MoveToElement("UInt64")) { values.Add(ReadUInt64("UInt64")); } // 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; }
} // Read public static unsafe uint Read(this NativeReader reader, uint offset, out UInt64Collection values) { values = new UInt64Collection(reader, offset); uint count; offset = reader.DecodeUnsigned(offset, out count); offset = checked(offset + count * sizeof(UInt64)); return offset; } // Read
/// <summary> /// Reads a ulong array from the stream. /// </summary> public UInt64Collection ReadUInt64Array(string fieldName) { int length = ReadArrayLength(); if (length == -1) { return null; } UInt64Collection values = new UInt64Collection(length); for (int ii = 0; ii < length; ii++) { values.Add(ReadUInt64(null)); } return values; }
/// <summary> /// Reads a ulong array from the stream. /// </summary> public UInt64Collection ReadUInt64Array(string fieldName) { var values = new UInt64Collection(); 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(ReadUInt64(null)); } finally { m_stack.Pop(); } } return values; }