Posted By: ido.ran | Mar 23rd @ 3:44 AM
page 1 of 1
Comments: 5 | Views: 570
Hi,
I wonder why all interfaces in the CLR BCL start with I ?
I know that the word interface start with I, but class also start with C and Microsoft stop put C on all classes after MFC.
Enum start with E, it doesn't mean we put E before every enum, right?

I think it's time to let that old habit go, it makes the code look much better, and much easier to talk about the code without putting "Ei" before every interface we are about to say.

What do you think?
Thanks.
W3bbo
W3bbo
The Master of Baiters
Readability, I guess.

C#, unlike Java, doesn't use the "extends"/"implements" keyword, but Java doesn't prefix its interfaces with "I".

So if you've got this:

class MyClass : Foo

...you've got no idea if Foo is a class or an interface.

The other reason is some kind of developer-friendly convention with COM which also had the IInterface scheme, but didn't do the same with other types. .NET builds on COM (in a way), so it's only natural to keep some of the naming system.

I think it's more your second reason than your first.  MS had all these developers using COM and to get them to switch to .NET they had to maintain some similarity.

VB still has separate keywords for it: inherits and implements.

Though it's not quite an answer here's a blog post from Brad Adams on the matter, maybe it helps:

http://blogs.msdn.com/brada/archive/2004/02/03/67033.aspx
CannotResolveSymbol
CannotResolveSymbol
{insert caption here}
The .NET Framework Design Guidelines prescribe the I before interface names...  they also say that, when you have a standard implementation of an interface, the class name should be the same as the interface name without the I (e.g. IAsyncResult and AsyncResult); you can't do that if you're not using a prefix on interface names.
page 1 of 1
Comments: 5 | Views: 570
Microsoft Communities