Posts

Showing posts from January, 2023

What is difference between IEnumrable and IQueryable in c#

 In entity framework if you use filter to search the records in table like employee table then  IEnumrable  - Get the all result from query and then  filter it at client side. IQueryable - It get the filters record from if we using IQuerable and it is very efficent.

What is Difference between IEnumrable and IEnumrator in C#

 https://www.c-sharpcorner.com/UploadFile/219d4d/ienumerable-vs-ienumerator-in-C-Sharp/ Both of these interfaces help to loop through the collection. The IEnumerable interface actually uses IEnumerator. The main reason to create an IEnumerable is to make the syntax shorter and simpler. The main difference between IEnumerable and IEnumerator is an IEnumerator retains its cursor's current state. So, if you want to loop sequentially through the collection, use an IEnumerable interface else if you want to retain the cursor position and want to pass it from one function to another function then use an IEnumerator interface.