Question: After almost 4 years of experience, I haven't seen a code where **yield** keyword is used. Can somebody show me a practical usage (along explanation) of this keyword, and if so, aren't there other ways easier to fullfill what it can do?

Answer: 
A practical example may be found here: 

<http://www.ytechie.com/2009/02/using-c-yield-for-readability-and-performance.html>

There are a number of advantages of using yield over standard code:

* If the iterator is used to build a list then you can yield the return and the caller can **decide** whether he wants that result in a list, or not.
* The caller may also decide to cancel the iteration for a reason that is outside of the scope of what you are doing in the iteration.
* Code is a bit shorter.

However, as Jan\_V said (just beat me to it by a few seconds :-) you can live without it because internally the compiler will produce code almost identical in both cases.
Elastic Search .NET example repo has a great example of using `yield return` to partition a collection into multiple collections with a specified size:

<https://github.com/elastic/elasticsearch-net-example/blob/master/src/NuSearch.Domain/Extensions/PartitionExtension.cs>

```
public static IEnumerable<IEnumerable<T>> Partition<T>(this IEnumerable<T> source, int size)
    {
        T[] array = null;
        int count = 0;
        foreach (T item in source)
        {
            if (array == null)
            {
                array = new T[size];
            }
            array[count] = item;
            count++;
            if (count == size)
            {
                yield return new ReadOnlyCollection<T>(array);
                array = null;
                count = 0;
            }
        }
        if (array != null)
        {
            Array.Resize(ref array, count);
            yield return new ReadOnlyCollection<T>(array);
        }
    }

```