Create More Readable Code By Interface Prefixes

My blog has moved.
You can view this post at the following address:
http://www.osherove.com/blog/2003/5/28/create-more-readable-code-by-interface-prefixes.html
Published Wednesday, May 28, 2003 11:17 AM by RoyOsherove
Filed under:

Comments

Tuesday, May 27, 2003 10:59 PM by Fabrice

# Chris Brumme

The following post has a high value to understand what happens:
http://blogs.gotdotnet.com/cbrumme/PermaLink.aspx/2fad6a65-3ced-49b4-ae8b-c4068bad25fc
Tuesday, May 27, 2003 11:09 PM by Royo

# re: Create More Readable Code By Interface Prefixes

Yes, I've read this article once, but could link it to this behavior.
At thought I thought there were some performance implications using this notation, but Chris's post says nothing about that.
It *does* mention performance implications when implicitly implementing an interface Vs. *explicitly* implementing it(i.e declaring ":IMyInterface" Vs. no declaration)
Tuesday, May 27, 2003 11:40 PM by Uwe Thomas

# re: Create More Readable Code By Interface Prefixes

I more like the feature of VS 2003:
When you type the ':IConfigurationSectionHandler' behind the class name, there is a little tooltip saying 'Press tab to implememnt stubs'. This way you get the complete implementaion within a #region

For your method be aware that the explicit interface implementation is not syntactic shuggar of C#.
The resulting IL is different and you even can have both versions (with and without explicit mention of the interface) at the same time.

The disadvantage from the handling point of view is, that you can call these functions only if you have an pointer of interface type. A pointer of the class type is not sufficient and you often have to cast to the interface first.

Wednesday, May 28, 2003 3:29 AM by Roy Osherove

# re: Create More Readable Code By Interface Prefixes

Thanks for the good tip, Uwe.
It's a keeper :)
Wednesday, February 18, 2004 9:20 AM by Randy Charles Morin

# re: Create More Readable Code By Interface Prefixes

Great Idea!