少一个DateTime?=null

Jan 9, 2010 at 2:27 PM

public static object ChangeType(object value, Type conversionType)
        {
            if (conversionType == typeof(Date))
            {
                return GetDate(value);
            }
            if (conversionType == typeof(Time))
            {
                return GetTime(value);
            }

这里少一个

if (conversionType == typeof(DateTime?))
            {
                if (value == null) return null;

            if (conversionType == typeof(Date?))
            {
                if (value == null) return null;
                return (Date?)(GetDate(value));
            }
            if (conversionType == typeof(Time?))
            {
                if (value == null) return null;
                return (Time?)(GetTime(value));
            }

Coordinator
Jan 9, 2010 at 3:35 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.