反射コード:メンバータイプを取得する唯一の方法を解析していますか?リターン以下
System.Collections.Generic.IList`1[TestReflection.Car] Cars
どのように私は反射によるCars
ルート型を得ることができますか?ないIList<Car>
- どうすればCar
を得ることができますか?
using System;
using System.Reflection;
using System.Collections.Generic;
namespace TestReflection
{
class MainClass
{
public static void Main(string[] args)
{
Type t = typeof(Dealer);
MemberInfo[] mi = t.GetMember("Cars");
Console.WriteLine("{0}", mi[0].ToString());
Console.ReadLine();
}
}
class Dealer
{
public IList<Car> Cars { get; set; }
}
class Car
{
public string CarModel { get; set; }
}
}