The code
BindingList<String> list = new BindingList<String>();
Console.WriteLine("Type: " + list.GetType());
produces the output
Type: System.ComponentModel.BindingList`1[System.String]
but what I want is just 'System.String'.
This question is essentially the opposite case from existing question Get type using reflection.
You can use Type.GetGenericArguments:
list.GetType().GetGenericArguments()[0];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With