Exemplo n.º 1
0
        /// <summary>
        /// Create a new meter report.
        /// </summary>
        /// <param name="Value">The meter value.</param>
        /// <param name="Unit">The unit of the meter value.</param>
        /// <param name="Type">The type of the meter value.</param>
        /// <param name="CustomData">An optional dictionary of customer-specific data.</param>
        private MeterReport(String Value,
                            String Unit,
                            MeterTypes Type,
                            IReadOnlyDictionary <String, Object> CustomData = null)

            : base(CustomData)

        {
            #region Initial checks

            if (Value.IsNullOrEmpty())
            {
                throw new ArgumentNullException(nameof(Value), "The given value must not be null or empty!");
            }

            if (Unit.IsNullOrEmpty())
            {
                throw new ArgumentNullException(nameof(Unit), "The given unit must not be null or empty!");
            }

            #endregion

            this.Value = Value.Trim();
            this.Unit  = Unit.Trim();
            this.Type  = Type;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Create a new meter report.
        /// </summary>
        /// <param name="Value">The meter value.</param>
        /// <param name="Unit">The unit of the meter value.</param>
        /// <param name="Type">The type of the meter value (energy, duration, ...).</param>
        /// <param name="CustomData">An optional dictionary of customer-specific data.</param>
        public static MeterReport Create(String Value,
                                         String Unit,
                                         MeterTypes Type,
                                         IReadOnlyDictionary <String, Object> CustomData = null)

        => new MeterReport(Value,
                           Unit,
                           Type,
                           CustomData);