public override object ConvertTo(ITypeDescriptorContext ctx, CultureInfo ci, object value, Type type) { ValidateType(value, typeof(CommaDelimitedStringCollection)); CommaDelimitedStringCollection internalValue = value as CommaDelimitedStringCollection; if (internalValue != null) { return internalValue.ToString(); } else { return null; } }
public void ConvertTo () { CommaDelimitedStringCollectionConverter cv = new CommaDelimitedStringCollectionConverter (); CommaDelimitedStringCollection col = new CommaDelimitedStringCollection(); col.Add ("hi"); col.Add ("bye"); Assert.AreEqual ("hi,bye", cv.ConvertTo (null, null, col, typeof (string)), "A1"); }