In this article, I describe what is polymorphism and when we use polymorphism in asp.net. polymorphism is one of the object oriented programming. It allows you to invoke derived class methods through a base class reference during runtime.
The following example describes how to implement yield return over foreach using c# .net. Create a method or a property with IEnumerable as the return type. Then somewhere in the method call yield return for each value you intent to have in the collection.
The following example describes how to perform foreach statement implemented using while statement. First the IEnumerablecollection is asked to create new enumerator instance (which implements IEnumerator). Then it calls IEnumerator.MoveNext() method until it returns false.