Chintan Dave

Chintan Dave

  • 1.9k
  • 67
  • 10.8k

Instance of Interface in C#

Aug 29 2018 4:34 AM
I have searched through internet that can we create instance of Interface or not , the answer that I receive is no.
Reference Link:
Then I find one article on C-sharpCorner site which comprises lines of code like below:
IEnumerable<string> iEnumerableOfString = (IEnumerable<string>)Month;
IEnumerator<string> iEnumeratorOfString = Month.GetEnumerator();
Reference Link :
Question: As per my knowledge, IEnumerable and IEumerator both are interfaces then how are we able to create instances of both mentioned in the above article?

Brought to you by:

Answers (1)