public static StateCapture CaptureState() { var stateCapture = new StateCapture(); foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies()) { var types = assembly.GetExportedTypes(); foreach (var reloadable in types.Where(t => t.IsSubclassOf(typeof(Reloadable)))) { var state = (byte[])reloadable.GetMethod("SaveState", BindingFlags.Public | BindingFlags.Static).Invoke(null, null); stateCapture.stateCapture.Add(new Tuple<string, byte[]>(reloadable.FullName, state)); } } return stateCapture; }
public static StateCapture CaptureState() { var stateCapture = new StateCapture(); foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies()) { var types = assembly.GetExportedTypes(); foreach (var reloadable in types.Where(t => t.IsSubclassOf(typeof(Reloadable)))) { var state = (byte[])reloadable.GetMethod("SaveState", BindingFlags.Public | BindingFlags.Static).Invoke(null, null); stateCapture.stateCapture.Add(new Tuple <string, byte[]>(reloadable.FullName, state)); } } return(stateCapture); }