Quickstarts.TestData.ToValueTypes C# (CSharp) Method

ToValueTypes() private method

Converts a list of DataValues to a list of test values.
private ToValueTypes ( DataValue>.SortedDictionary values ) : ValueType[]
values DataValue>.SortedDictionary
return ValueType[]
        private ValueType[] ToValueTypes(SortedDictionary<DateTime, DataValue> values)
        {
            if (values == null || values.Count == 0)
            {
                return null;
            }

            List<ValueType> serializedValues = new List<ValueType>();

            foreach (DataValue dv in values.Values)
            {
                ValueType value = new ValueType();
                value.Timestamp = FormatTimestamp(dv.SourceTimestamp);
                value.Value = FormatValue(dv.WrappedValue);
                value.Quality = FormatQuality(dv.StatusCode);
                value.Comment = dv.Comment;
                serializedValues.Add(value);            
            }

            return serializedValues.ToArray();
        }
        #endregion