コード例 #1
0
        /// <summary>
        /// Determines whether the specified <see cref="T:System.Object"/> is equal to the current <see cref="T:System.Object"/>.
        /// </summary>
        /// <param name="obj">The <see cref="T:System.Object"/> to compare with the current <see cref="T:System.Object"/>.</param>
        /// <returns>
        /// true if the specified <see cref="T:System.Object"/> is equal to the current <see cref="T:System.Object"/>; otherwise, false.
        /// </returns>
        /// <exception cref="T:System.NullReferenceException">
        /// The <paramref name="obj"/> parameter is null.
        /// </exception>
        public override bool Equals(object obj)
        {
            SingleValueFactory asSingleValueFactory = obj as SingleValueFactory;

            return(asSingleValueFactory != null &&
                   EqualsImplementationUtils.SafeEquals(_theValue, asSingleValueFactory._theValue));
        }
コード例 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ValueFactoryWithOptionalConcreteValue"/> class.
        /// </summary>
        /// <param name="valueFactory">The value factory.</param>
        public ValueFactoryWithOptionalConcreteValue(IValueFactory valueFactory)
        {
            if (valueFactory == null)
            {
                throw new ArgumentNullException("valueFactory");
            }
            _valueFactory = valueFactory;
            SingleValueFactory asSingleValueFactory = valueFactory as SingleValueFactory;

            if (asSingleValueFactory != null)
            {
                // If it's a single value, it's concrete.
                _value      = asSingleValueFactory.GetBaseValue();
                _isConcrete = true;
            }
            else
            {
                _isConcrete = false;
            }
        }