namespace reflection
{
internal class Program
{
// just sample
static void Main(string[] args)
{
List<Person> list = new List<Person>();
list.Add(new Person() { Age= 2, Name="a"});
list.Add(new Person() { Age = 3, Name = "b" });
var analyse = new analyse();
analyse.analyseThis(list);
Console.ReadLine();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace reflection
{
public class Person
{
public string Name { get; set; }
public int Age { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace reflection
{
public class analyse
{
public void analyseThis(object test)
{
var data = test.GetType().GenericTypeArguments[0];
// how to get this working
foreach (var customClass in test.GetType().)
{
// below works for clASS.
Type type = customClass.GetType();
PropertyInfo[] propertyInfos = customClass.GetType().GetProperties();
// here the code
}
}
}
}
namespace reflection
{
internal class Program
{
// just sample
static void Main(string[] args)
{
List<Person> list = new List<Person>();
list.Add(new Person() { Age= 2, Name="a"});
list.Add(new Person() { Age = 3, Name = "b" });
var analyse = new analyse();
analyse.analyseThis(list);
Console.ReadLine();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace reflection
{
public class Person
{
public string Name { get; set; }
public int Age { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace reflection
{
public class analyse
{
public void analyseThis(object test)
{
var data = test.GetType().GenericTypeArguments[0];
// how to get this working
foreach (var customClass in test.GetType().)
{
// below works for clASS.
Type type = customClass.GetType();
PropertyInfo[] propertyInfos = customClass.GetType().GetProperties();
// here the code
}
}
}
}