Why would you put that method in a controller? It belongs into a static helper class or something like this. You could even make it an extension method, if you want to go fancy.
public static class OutputExtensions
{
public static void Export<T>(this List<T> list)
{
// get properties of Model
PropertyInfo[] properties = typeof(T).GetProperties();
foreach (var property in properties)
{
if (property.CanRead)
PRINTOUT(property.Name);
}
foreach (var entity in list)
{
foreach (var property in properties)
{
if (property.CanRead)
PRINTOUT(property.GetValue(entity, null));
}
}
}
}
(This version also contains the fix suggested by Trevor Pilley in his comment)
You could use it like this in every controller:
listOfModels.Export();