コード例 #1
0
        /// <summary>
        /// Converts the value of this instance to an equivalent string value using the specified culture-specific formatting information.
        /// </summary>
        /// <param name="provider">An <see cref="IFormatProvider"/> interface implementation that supplies culture-specific formatting information.</param>
        /// <returns>A string value equivalent to the value of this instance.  May be null.</returns>
        public override string ToString(IParameter targetParameter)
        {
            if (_value == null)
            {
                throw ThrowHelper.New <InternalErrorException>(this, InternalErrors.UnexpectedNullReference, "_value", this.GetType().Name);
            }

            try
            {
                return(_value.ToWireValue(targetParameter.EnumPairs));
            }
            catch (InvalidOperationException ex)
            {
                throw ThrowHelper.Rethrow(this, ex, ErrorMessages.UnsuccessfulSetParameterOperation, targetParameter.Name, Id, ex.Message);
            }
        }