How do I loop through a generic list and call a method based on a couple of conditions? I’d like to use linq syntax. The following doesn’t work of course. Any ideas?
somelist.ForEach(i => i.DeptType == 1 && i != null () {MyMethod(someInt)});
If that isn’t possible, what is the next best method using concise syntax?
Try using Where to specify which records you want to select and ForEach to execute your method: