Nullable bool gives false

Sep 25, 2012 at 2:43 PM

Hi,

I've changed a method ToXmlBoolean(..) to provide empty string if given value is nullable instead of returning a false value

public static string ToXmlBoolean(object value)
        {
            bool result = false;
            bool.TryParse(value.ToString(), out result);
            return (result) ? "1" : "0";
        }
to
public static string ToXmlBoolean(object value)
        {
           if (value == DBNull.Value)
	return string.Empty;

            bool result = false;
            bool.TryParse(value.ToString(), out result);
            return (result) ? "1" : "0";
        }
Thank you for the project