public static KeyValuePair <TKey, TValue> GetCurrent <TKey, TValue>(this LightningCursor cursor) { var pair = cursor.GetCurrent(); var key = cursor.Database.FromBytes <TKey>(pair.Key); var value = cursor.Database.FromBytes <TValue>(pair.Value); return(new KeyValuePair <TKey, TValue>(key, value)); }
public static IEnumerable <ValueTuple <MDBValue, MDBValue> > AsEnumerable(this LightningCursor cursor) { while (cursor.Next() == MDBResultCode.Success) { var(resultCode, key, value) = cursor.GetCurrent(); resultCode.ThrowOnError(); yield return(key, value); } }