Language: C#
Resharper 5 beta - Extension method refactoring
1: foreach (var group in groups) 2: { 3: if (group.AllowsPermission(permissionType)) 4: { 5: cache.Put(cacheKey, new List<bool> {true}); 6: return true; 7: } 8: } 9: 10: 11: //refactors to 12: 13: if (Enumerable.Any(groups, group => group.AllowsPermission(permissionType))) 14: { 15: cache.Put(cacheKey, new List<bool> {true}); 16: return true; 17: } 18: 19: //could (should) refactor to 20: 21: if (groups.Any(group => group.AllowsPermission(permissionType))) 22: { 23: cache.Put(cacheKey, new List<bool> {true}); 24: return true; 25: }
Tags:
Report Abuse
Subscribe
Discuss
What's new
What is it
New Snippet
Recent Snippets
My Snippets
Web Code
Search

