/** * This method returns all corners that match the delegate's conditions. * * The following are examples of how this method can be used: * With a lambda expression: * GetWallCornersBy((corner) => corner.GetID() == id); * * With a anonymous delegate: * GetWallCornersBy(delegate(WallCorner corner) { * return corner.GetID() == id; * }); */ public List<Corner> GetWallCornersBy(CornerMatchDelegate match) { List<Corner> rtn = new List<Corner>(); foreach(Corner corner in this._corners) { if(match(corner)) { rtn.Add(corner); } } return rtn; }
/** * This method returns the first corner that matches the delegate's conditions. * * The following are examples of how this method can be used: * With a lambda expression: * GetWallCornerBy((corner) => corner.GetID() == id); * * With a anonymous delegate: * GetWallCornerBy(delegate(WallCorner corner) { * return corner.GetID() == id; * }); */ public Corner GetWallCornerBy(CornerMatchDelegate match) { Corner rtn = null; foreach(Corner corner in this._corners) { if(match(corner)) { rtn = corner; } } return rtn; }