36
"IsArray" öğesinin doğru döndüğü bir System.Type örneğim var.Dizinin iç içe türünü (öğe tipi) belirlemek için yansımayı nasıl kullanırım?
Dizi türünün "iç içe türünü" nasıl belirleyebilirim?
yani
Type GetArrayType(Type t)
{
if(t.IsArray)
{
// What to put here?
}
throw new Exception("Type is not an array");
}
Assert.That(GetArrayType(typeof(string[])), Iz.EqualTo(typeof(string));
Assert.That(GetArrayType(typeof(Foo[])), Iz.EqualTo(typeof(Foo));
Mükemmel! Teşekkürler! –
Amacım :). – swilliams