daily pastebin goal
8%
SHARE
TWEET

Untitled

a guest Jun 23rd, 2018 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. List<testObject> objectList = new List<testObject>();
  2.  
  3. // populate objectList with testObjects
  4.  
  5. objectList.FindAll(GroupLevel0);
  6.  
  7. private static bool GroupLevel0(testObject item)
  8. { return item._groupLevel == 0; }
  9.  
  10. private class testObject
  11. {
  12.      public string _FieldSQL = null;
  13.      public int _groupLevel;
  14. }
  15.    
  16. List<testObject> objectList = new List<testObject>();
  17. int desiredGroupLevel = 10;
  18.  
  19. objectList.FindAll(delegate (testObject item)
  20. {
  21.     return item._groupLevel == desiredGroupLevel;
  22. });
  23.    
  24. List<testObject> objectList = new List<testObject>();
  25. int desiredGroupLevel = 10;
  26.  
  27. objectList.FindAll(CheckGroupLevel(desiredGroupLevel));
  28.  
  29. ...
  30.  
  31. public Predicate<testItem> CheckGroupLevel(int level)
  32. {
  33.     return delegate (testItem item)
  34.     {
  35.         return item._groupLevel == level;
  36.     };
  37. }
  38.    
  39. int groupLevel = 0;
  40.  
  41.   objectList.FindAll(
  42.        delegate(testObject item)
  43.        {
  44.           return item._groupLevel == groupLevel;
  45.        });
  46.    
  47. List<testObject> objectList = new List<testObject>();
  48.  
  49. // populate objectList with testObjects
  50.  
  51. objectList.FindAll(delegate(testObject o){ return GroupLevel(o, 0);} );
  52.  
  53. private static bool GroupLevel(testObject item, int groupLevel)
  54. { return item._groupLevel == groupLevel; }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top