示例#1
0
        public override object ConvertFrom(ITypeDescriptorContext context, Globalization.CultureInfo culture, object value)
        {
            if (value == null)
            {
                throw GetConvertFromException(value);
            }

            var source = value as string;

            if (source != null)
            {
                return(ExtendedDateTimeCollection.Parse(source));
            }

            return(base.ConvertFrom(context, culture, value));
        }
 public void CanRoundTrip()
 {
     Assert.AreEqual("{1667,1668,1670..1672}", ExtendedDateTimeCollection.Parse("{1667,1668,1670..1672}").ToString());
     Assert.AreEqual("{1960,1961-12}", ExtendedDateTimeCollection.Parse("{1960,1961-12}").ToString());
 }