获取通用List <T>对象的T类型

Ric*_*ard 2 c# generics reflection list

可能重复:
反射 - 从System.Type实例获取泛型参数
获取泛型List <T>中的实际T类型

我正在从一个Class循环一个PropertyInfo-List.在这个类中,我有兴趣在不同的列表-例如List<int>,List<string>,List<Book>,麻生太郎.

但我不知道如何获得列表对象的类型.我只是得到类似的东西

System.Collections.Generic.List`1[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, 
PublicKeyToken=b77a5c561934e089]].
Run Code Online (Sandbox Code Playgroud)

我可以将这些信息分开并根据这些信息创建一个Type,但我希望有更平滑的方式?

Err*_*Efe 9

简单:

Type type = list.GetType().GetGenericArguments()[0];
// The first argument will be the `T` inside `List<T>`... so the list type ;)
Run Code Online (Sandbox Code Playgroud)