Exemplo n.º 1
0
        /// <summary>
        /// initialize new instance of <see cref="ColumnValue{T}" /> that Fill all Columns
        /// </summary>
        /// <param name="columnValueStates">the way to search for this Column valve</param>
        /// <param name="value">the value for this column</param>
        public ColumnValue(ColumnToValue columnValueStates, T value)
        {
            if (!Enum.IsDefined(typeof(ColumnToValue), columnValueStates))
            {
                throw new InvalidEnumArgumentException(nameof(columnValueStates), (int)columnValueStates,
                                                       typeof(ColumnToValue));
            }

            ColumnToValue = columnValueStates;
            Value         = value;
        }
Exemplo n.º 2
0
        /// <summary>
        /// initialize new instance of <see cref="ColumnValue{T}" /> that Fill all Columns
        /// </summary>
        /// <param name="name">the Column that will be used in the column</param>
        /// <param name="columnValueStates">the way to search for this Column valve</param>
        /// <param name="value">the value for this column</param>
        /// <exception cref="InvalidEnumArgumentException"></exception>
        /// <exception cref="ArgumentNullException"></exception>
        public ColumnValue(string name, ColumnToValue columnValueStates, T value)
        {
            if (!Enum.IsDefined(typeof(ColumnToValue), columnValueStates))
            {
                throw new InvalidEnumArgumentException(nameof(columnValueStates), (int)columnValueStates,
                                                       typeof(ColumnToValue));
            }
            if (string.IsNullOrWhiteSpace(name))
            {
                throw new ArgumentException("Value cannot be null or whitespace.", nameof(name));
            }

            if (value != null)
            {
                Name          = name;
                ColumnToValue = columnValueStates;
                Value         = value;
            }
            else
            {
                throw new ArgumentNullException(nameof(value));
            }
        }