void ProcessWhen() { //execute all when items found. _fields.Where(fieldInfo => fieldInfo.FieldType == typeof(when)) .Select(fieldInfo => new { Delegate = (when)fieldInfo.GetValue(_testClass), Field = fieldInfo }).ToList() .ForEach(x => { x.Delegate.Invoke(); _testStateManager.AddWhen(x.Field.Name, x.Delegate); }); }