Tuesday, March 13, 2012

The IEnumerator Interface

Hi everyone,

I have a quick question about interfaces in C#.
When you want to use an enumerator in C#, I think you have to do something like the following:

IEnumerator e = object.getEnumerator();

My question is very simple - if interfaces by definition have no implementation, how can it hold a fully blown object! Whats going on 'ere!

Thanks all

SimonFrom .NEt Framework glossary:

interface

A reference type that defines a contract. Other types implement an interface to guarantee that they support certain operations. The interface specifies the members that must be supplied by classes or other interfaces that implement it. Like classes, interfaces can contain methods, properties, indexers, and events as members

0 comments:

Post a Comment