using System.Collections.Generic;
public static void Main()
ListOfVariablesToSave myListOfVariablesToSave = new ListOfVariablesToSave();
foreach (PropertyInfo pi in myListOfVariablesToSave
.GetProperties( BindingFlags.Public |
BindingFlags.DeclaredOnly )
.Where(p => p.PropertyType.ToString().Contains("List") &&
p.PropertyType.ToString().Contains("System.Int32"))
Console.WriteLine(pi.Name);
(pi.GetValue(myListOfVariablesToSave) as List<int>).ForEach(i => Console.WriteLine(i));
public class ListOfVariablesToSave : List<List<int>>
public List<int> controlDB { get; set; }
public List<int> interacDB { get; set; }
public int Test {get; set;}
public ListOfVariablesToSave()
controlDB = new List<int> { 1, 2, 3 };
interacDB = new List<int> { 21, 22, 23 };