Пример #1
0
 /**
  * This method returns all walls that match the delegate's conditions.
  *
  * The following are examples of how this method can be used:
  * 	With a lambda expression:
  * 		GetWallBy((wall) => wall.GetID() == id);
  *
  * 	With a anonymous delegate:
  * 		GetWallBy(delegate(Wall wall) {
  * 			return wall.GetID() == id;
  * 		});
  */
 public List<Wall> GetWallsBy(WallMatchDelegate match)
 {
     List<Wall> rtn = new List<Wall>();
     foreach(Wall wall in this._walls) {
         if(match(wall)) {
             rtn.Add(wall);
         }
     }
     return rtn;
 }
Пример #2
0
 /**
  * This method returns the first wall that matches the delegate's conditions.
  *
  * The following are examples of how this method can be used:
  * 	With a lambda expression:
  * 		GetWallBy((wall) => wall.GetID() == id);
  *
  * 	With a anonymous delegate:
  * 		GetWallBy(delegate(Wall wall) {
  * 			return wall.GetID() == id;
  * 		});
  */
 public Wall GetWallBy(WallMatchDelegate match)
 {
     Wall rtn = null;
     foreach(Wall wall in this._walls) {
         if(match(wall)) {
             rtn = wall;
         }
     }
     return rtn;
 }