public D Mapper<D, S>(S s)
{
D d = Activator.CreateInstance<D>();
try
{
var sType = s.GetType();
var dType = typeof(D);
foreach (PropertyInfo sP in sType.GetProperties())
{
foreach (PropertyInfo dP in dType.GetProperties())
{
if (dP.Name == sP.Name)
{
dP.SetValue(d, sP.GetValue(s)); break;
}
}
}
}
catch (Exception ex)
{
}
return d;
}