Beispiel #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="vLogs.Objects.KeyValues.KeyValuePair"/> class with the specified key and string value.
        /// </summary>
        /// <param name="key"></param>
        /// <param name="value"></param>
        /// <exception cref="System.ArgumentNullException">Thrown when the given key or value are null.</exception>
        public KeyValuePair(string key, string value)
        {
            if (key == null)
                throw new ArgumentNullException("key");
            if (value == null)
                throw new ArgumentNullException("value");

            this._key = key;
            this._type = KvpValueType.String;
            this._string = value;
        }
Beispiel #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="vLogs.Objects.KeyValues.KeyValuePair"/> class with the specified key and collection value.
        /// </summary>
        /// <remarks>
        /// The given collection must be locked (read-only).
        /// </remarks>
        /// <param name="key"></param>
        /// <param name="value"></param>
        /// <exception cref="System.ArgumentNullException">Thrown when the given key or value are null.</exception>
        /// <exception cref="System.ArgumentException">Thrown when the given collection is not locked (read-only).</exception>
        public KeyValuePair(string key, KeyValueCollection value)
        {
            if (key == null)
                throw new ArgumentNullException("key");
            if (value == null)
                throw new ArgumentNullException("value");

            if (!value.IsReadOnly)
                throw new ArgumentException("The given key/value collection must be locked (read-only) to assure the immutability of the object.", "value");

            this._key = key;
            this._type = KvpValueType.Collection;
            this._col = value;
        }
Beispiel #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="vLogs.Objects.KeyValues.KeyValuePair"/> class with the specified key and double value.
        /// </summary>
        /// <param name="key"></param>
        /// <param name="value"></param>
        /// <exception cref="System.ArgumentNullException">Thrown when the given key is null.</exception>
        public KeyValuePair(string key, double value)
        {
            if (key == null)
                throw new ArgumentNullException("key");

            this._key = key;
            this._type = KvpValueType.Double;
            this._double = value;
        }