Esempio n. 1
0
        /// <summary>
        /// Convert a field to a string
        /// </summary>
        /// <param name="o">object we want to convert</param>
        /// <returns>string representation of the string</returns>
        internal string ValueToString(object o)
        {
            if (mDecimalConv == null)
            {
                mDecimalConv = new DecimalConverter(DecimalSeparator);
                mDoubleConv  = new DoubleConverter(DecimalSeparator);
                mSingleConv  = new SingleConverter(DecimalSeparator);
                mDateConv    = new DateTimeConverter(DateFormat);
            }

            if (o == null)
            {
                return(string.Empty);
            }
            else if (o is DateTime)
            {
                return(mDateConv.FieldToString(o));
            }
            else if (o is decimal)
            {
                return(mDecimalConv.FieldToString(o));
            }
            else if (o is double)
            {
                return(mDoubleConv.FieldToString(o));
            }
            else if (o is float)
            {
                return(mSingleConv.FieldToString(o));
            }
            else
            {
                return(o.ToString());
            }
        }