Adroit.Data.BDB46.Locate C# (CSharp) Method

Locate() public method

public Locate ( BdbLocateFunc func ) : object>.KeyValuePair
func BdbLocateFunc
return object>.KeyValuePair
		public KeyValuePair<object,object> Locate (BdbLocateFunc func)
		{
			if (func == null)
				throw new ArgumentNullException ("func");

			using (var cursor = NewCursor ()) {
				object key, value;
				while (cursor.Get (Cursor.Seek.Next, out key, out value)) {
					if (func (key, value))
						return new KeyValuePair<object,object> (key, value);
				}
			}

			throw new Exception ("Not found");
		}