Example #1
0
 /**
  * The following are examples of how this method can be used:
  * 	With a lambda expression:
  * 		GetLocationsBy((location) => location.ID == location);
  *
  * 	With an anonymous delegate:
  * 		GetLocationsBy(delegate(Location location) {
  * 			return location.ID == location;
  * 		});
  * <param name="match"> Checks if the locations are the same, or not. </param>
  * <returns> This method returns all floors that match the delegate's conditions. </returns>
  */
 public List<Location> GetLocationsBy(LocationMatchDelegate match)
 {
     List<Location> locations = new List<Location>();
     foreach (Location location in this._locations) {
         if (match(location))
             locations.Add(location);
     }
     return locations;
 }
Example #2
0
 /**
  * The following are examples of how this method can be used:
  * 	With a lambda expression:
  * 		GetLocationBy((location) => location.ID == location);
  *
  * 	With an anonymous delegate:
  * 		GetLocationBy(delegate(Location location) {
  * 			return location.ID == location;
  * 		});
  * <param name="match"> Checks if the locations are the same, or not. </param>
  * <returns> This method returns the first location that matches the delegate's conditions. </returns>
  */
 public Location GetLocationBy(LocationMatchDelegate match)
 {
     Location rtn = null;
     foreach (Location location in this._locations) {
         if (match(location)) {
             rtn = location;
             break;
         }
     }
     return rtn;
 }