Change how a collection is displayed in the property grid
See the question and my original answer on StackOverflowYou can use a TypeConverterAttribute with a custom TypeConverter, something like this:
public class Sample
{
public Sample()
{
Ints = new List<int>();
}
[TypeConverter(typeof(MyConverter))]
public List<int> Ints { get; }
}
public class MyConverter : TypeConverter
{
public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
{
if (destinationType == typeof(string))
return "Hello world";
return base.ConvertTo(context, culture, value, destinationType);
}
}