src/Misc/EFTools/XmlCore/Model/DefaultableValue.cs
/// <summary>
///     This method converts the passed in value to a string, using the XmlConvert class.
///     NOTE: If this is string, do not encode it.
/// </summary>
/// <param name="value">The value that we want to convert to a string</param>
/// <returns></returns>
This method converts the passed in value to a string, using the XmlConvert class.
NOTE: If this is string, do not encode it.
This method converts the passed in value to a string using the XmlConvert class . NOTE : If this is string do not encode it .
protected static string GetXmlString(object value)
        {
            if (value is int)
            {
                return XmlConvert.ToString((int)value);
            }
            if (value is uint)
            {
                return XmlConvert.ToString((uint)value);
            }
            else if (value is double)
            {
                return XmlConvert.ToString((double)value);
            }
            else if (value is float)
            {
                return XmlConvert.ToString((float)value);
            }
            else if (value is decimal)
            {
                var decimalValue = (decimal)value;
                if (decimalValue == UnboundedDecimal)
                {
                    return UnboundedString;
                }
                else
                {
                    return XmlConvert.ToString(decimalValue);
                }
            }
            else if (value is bool)
            {
                var val = (bool)value;
                return XmlConvert.ToString(val);
            }
            else if (value is string)
            {
                return value.ToString();
            }
            else if (value is Enum)
            {
                return value.ToString();
            }
            else if (value is XNamespace)
            {
                return value.ToString();
            }
            else
            {
                Debug.Assert(false);
                return value.ToString();
            }
        }
protected static string GetXmlString ( object value ) { if ( value is int ) { return XmlConvert . ToString ( ( int ) value ) ; } if ( value is uint ) { return XmlConvert . ToString ( ( uint ) value ) ; } else if ( value is double ) { return XmlConvert . ToString ( ( double ) value ) ; } else if ( value is float ) { return XmlConvert . ToString ( ( float ) value ) ; } else if ( value is decimal ) { var decimalValue = ( decimal ) value ; if ( decimalValue == UnboundedDecimal ) { return UnboundedString ; } else { return XmlConvert . ToString ( decimalValue ) ; } } else if ( value is bool ) { var val = ( bool ) value ; return XmlConvert . ToString ( val ) ; } else if ( value is string ) { return value . ToString ( ) ; } else if ( value is Enum ) { return value . ToString ( ) ; } else if ( value is XNamespace ) { return value . ToString ( ) ; } else { Debug . Assert ( false ) ; return value . ToString ( ) ; } }
This method converts the passed in value to a string, using the XmlConvert class.
This method converts the passed in value to a string using the XmlConvert class .
None
value
object
The value that we want to convert to a string
The value that we want to convert to a string