public static bool TryGet <TKey, TValue>(this LightningTransaction txn, LightningDatabase db, TKey key, out TValue value) { GetByOperation operation; var result = txn.TryGetBy(db, key, out operation); value = result ? operation.Value <TValue>() : default(TValue); return(result); }
/// <summary> /// Tries obtaining a value by key /// </summary> /// <typeparam name="TKey">Type of a key.</typeparam> /// <param name="txn">A transaction.</param> /// <param name="key">Key.</param> /// <param name="value">Obtained value converter if successful.</param> /// <returns>Returns true if key-value pair exists in database or false if not.</returns> public static bool TryGetBy <TKey>(this LightningTransaction txn, TKey key, out GetByOperation value) { return(txn.TryGetBy(key, out value)); }