NullableConverter for Nullable properties of WinForms component
See the question and my original answer on StackOverflowThe property grid uses TypeDescriptor to gets its converter information. So for example, if you have this class:
public class MyClass
{
public int? NullableInteger { get; set; }
}
With this code:
// get first property's type converter
var cv = TypeDescriptor.GetProperties(typeof(MyClass))[0].Converter;
You will get the TypeConverter
for the NullableInteger
property, which is already NullableConverter
.
So, you don't have to declare it manually.