LeetCode: LRU cache implementation C#
The indentation is inconsistent: the test class has its {} indented the same as the class declaration, but the main class has them indented one level more.



It's good that you've included a unit test, but it's only testing half of the functionality. What about the getter?



put and get as method names don't follow C# conventions, which would be Put and Get -- although it would be even more idiomatic here to make them an indexer. The original task is phrased in terms which are as language-agnostic as possible, but in an interview you should aim to show language knowledge where you have it as well as general knowledge and skill.



Is there any reason for hard-coding int as the type of the key and value rather than making them generic?




private List&lt;KeyValuePair&lt;int, int&gt;&gt; _orderList;



Two questions: firstly, why KeyValuePair&lt;int, int&gt;? I don't see anything which uses the value. Secondly, why include List in the name? The type says that already.




                _orderList.Remove(toRemove);






            var tempCacheCell = _orderList.FirstOrDefault(x=&gt;x.Key == key);
            _orderList.Remove(tempCacheCell);
            _orderList.Add(tempCacheCell);



What's the asymptotic complexity of adding or fetching an element? It can certainly be improved. Hint: one approach would be to manually implement a different type of list. Alternative hint: there's some quite powerful collections in .Net Framework (I haven't checked which of them made it into .Net Standard).