Repository: microsoft/garnet
File: libs/server/Transaction/TxnKeyManager.cs (C#)

Code before:
        }

        /// <summary>
        /// Returns a list of keys for commands: MGET, DEL, UNLINK
        /// </summary>
        private int ListKeys(int inputCount, bool isObject, LockType type)
        {
            for (int i = 0; i < inputCount; i++)
            {
                var key = respSession.GetCommandAsArgSlice(out bool success);
                if (!success) return -2;
                SaveKeyEntryToLock(key, isObject, type);
                SaveKeyArgSlice(key);
            }
            return inputCount;
        }

        /// <summary>
        /// Returns a list of keys for LMPOP command
        /// </summary>
        private int LMPOPKeys(int inputCount, bool isObject, LockType type)
        {
            var numKeysArg = respSession.GetCommandAsArgSlice(out bool success);
            if (!success) return -2;

            var numKeys = Convert.ToInt32(numKeysArg.ToString());

            for (int i = 0; i < numKeys; i++)
            {
                var key = respSession.GetCommandAsArgSlice(out success);
                if (!success) return -2;
                SaveKeyEntryToLock(key, isObject, type);
                SaveKeyArgSlice(key);
            }
            return numKeys;
        }

        /// <summary>
        /// Returns a list of keys for MSET commands
        /// </summary>
        private int MSETKeys(int inputCount, bool isObject, LockType type)
        {
            for (int i = 0; i < inputCount; i += 2)
            {
                var key = respSession.GetCommandAsArgSlice(out bool success);
                if (!success) return -2;
                var val = respSession.GetCommandAsArgSlice(out success);
                if (!success) return -2;
                SaveKeyEntryToLock(key, isObject, type);
                SaveKeyArgSlice(key);
            }

Review comment (suggestion):
Please use: ```NumUtils.TryParse(numKeysArg.ReadOnlySpan, out var numKeys)```

Code after:
            SaveKeyEntryToLock(key, isObject, type);
            SaveKeyArgSlice(key);
            return arg;
        }

        /// <summary>
        /// Returns a list of keys for commands: MGET, DEL, UNLINK
        /// </summary>
        private int ListKeys(int inputCount, bool isObject, LockType type)
        {
            for (int i = 0; i < inputCount; i++)
            {
                var key = respSession.GetCommandAsArgSlice(out bool success);
                if (!success) return -2;
                SaveKeyEntryToLock(key, isObject, type);
                SaveKeyArgSlice(key);
            }
            return inputCount;
        }

        /// <summary>
        /// Returns a list of keys for LMPOP command
        /// </summary>
        private int ListKeys(bool isObject, LockType type)
        {
            var numKeysArg = respSession.GetCommandAsArgSlice(out bool success);
            if (!success) return -2;

            if (!NumUtils.TryParse(numKeysArg.ReadOnlySpan, out int numKeys)) return -2;

            for (int i = 0; i < numKeys; i++)
            {
                var key = respSession.GetCommandAsArgSlice(out success);
                if (!success) return -2;
                SaveKeyEntryToLock(key, isObject, type);
                SaveKeyArgSlice(key);
            }
            return numKeys;
        }

        /// <summary>
        /// Returns a list of keys for MSET commands
        /// </summary>
        private int MSETKeys(int inputCount, bool isObject, LockType type)
        {
            for (int i = 0; i < inputCount; i += 2)
            {
                var key = respSession.GetCommandAsArgSlice(out bool success);
                if (!success) return -2;
                var val = respSession.GetCommandAsArgSlice(out success);
                if (!success) return -2;