new List<int>().GetType().Name is List`1. How do I get a name more like List<int> (not List<T>)?
new List<int>().GetType().Name is List`1. How do I get a name more like List<int> (
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
One way would be using
new List<int>().GetType().ToString(), which returnsSystem.Collections.Generic.List`1[System.Int32].Or you could write yourself a small helper method along the lines of:
which outputs strings like:
Note that for nested types, this would return only the innermost name.