There is a possibility to create a method using more than one type of generic , more or less like this.
public static TResult ToEntityForType<TResult>(this DataRow row, TType type) where TType : Type
{
TResult entity = Activator.CreateInstance<TType>() as TResult;
List<PropertyInfo> properties = entity.GetType().GetProperties().ToList();
DataColumnCollection columnsTable = row.Table.Columns;
for (int i = 0; i < columnsTable.Count; i++)
{
PropertyInfo prop = properties.Single(x => x.Name.ToUpper() == columnsTable[i].ColumnName.ToUpper());
if (prop != null)
{
string result = Convert.ToString(row[i]);
if (result.Trim() == String.Empty)
prop.SetValue(entity, null);
else
prop.SetValue(entity, row[i]);
}
}
return entity;
}