• What is yield return

    Can understand yield return as lazy versus normal return as eager. In an iterator block, normal return returns the entire resultset at once. While yield return returns instance of IEnumerable (implemented by Array/List), and then returns one by one when we access the value (the index position will be noted for the next access). Iterators can be used to lazily generate a sequence of objects. So the code in the method only executed once we need the value (and it’s one by one)
  • GetHashCode vs Equal

    Hash-based data structures like hash tables, dictionaries, and sets. The GetHashCode() method creates a unique code for each item in these data structures, while the Equals() method is used to check if two objects are the same. When two objects are considered equal based on the Equals() method, their hash codes must be identical (giống hệt nhau)
  • throw vs throw ex

    Throw preserves (bảo quản, lưu giữ) the stack trace. So let’s say Method2 calls Method1, Method1 throws Error1, it’s caught by Method2 and Method2 says throw then Method1 Error1 + Method2 Error2 will be available in the stack trace.