Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / October 2007

Tip: Looking for answers? Try searching our database.

Interface in .NET -- mutable or not?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
gz - 11 Oct 2007 18:59 GMT
Hi All,

It is my understanding that with .NET you can add or remove methods in
your interface while still maintain binary compatibility. This is not
true for COM. Does this mean that published interfaces under .NET are
no longer required to be immutable?

Best regards,
gz
Peter Bromberg [C# MVP] - 11 Oct 2007 20:45 GMT
If you add a method to an interface, any class that derives from it will
break because it does not fully implement your interface. Does that help?
-- Peter
Recursion: see Recursion
site:  http://www.eggheadcafe.com
unBlog:  http://petesbloggerama.blogspot.com
BlogMetaFinder:    http://www.blogmetafinder.com

> Hi All,
>
[quoted text clipped - 5 lines]
> Best regards,
> gz
gz - 11 Oct 2007 21:26 GMT
On Oct 11, 2:45 pm, Peter Bromberg [C# MVP]
<pbromb...@yahoo.yohohhoandabottleofrum.com> wrote:
> If you add a method to an interface, any class that derives from it will
> break because it does not fully implement your interface. Does that help?
[quoted text clipped - 15 lines]
>
> - Show quoted text -

Hi Peter,

I can see that. But am I supposed to change the interface even in the
cases when I can?

Thanks,
gz
Brian Gideon - 11 Oct 2007 20:54 GMT
> Hi All,
>
[quoted text clipped - 5 lines]
> Best regards,
> gz

Making any changes to an interface will break version compatibility.
Well, except in VB.NET you could add a nested type in an interface and
I don't think that would break anything, but I haven't tried it.
Jeff Louie - 11 Oct 2007 23:19 GMT
Well Visual Basic 2008 supports extension methods which provides "a way
to
extend existing types with new functionality without changing the
existing
contract"

Regards,
Jeff
Christof Nordiek - 12 Oct 2007 15:23 GMT
> Well Visual Basic 2008 supports extension methods which provides "a way
> to
That's also true for C# 3.0 (=C# Version in VS 2008)

Christof
Registered User - 12 Oct 2007 13:07 GMT
>Hi All,
>
>It is my understanding that with .NET you can add or remove methods in
>your interface while still maintain binary compatibility.
>This is not true for COM.

The major differences between COM and .NET interfaces seem to be
1 .NET interfaces are not derived from IUnknown
2 .NET interfaces do not represent any sort of binary standard

> Does this mean that published interfaces under .NET are
>no longer required to be immutable?

Common sense alone says no. If an interface wasn't immutable what
purpose would the contract serve?

regards
A.G.
Larry Smith - 12 Oct 2007 13:32 GMT
> 2 .NET interfaces do not represent any sort of binary standard

You may appreciate this (by one of the world's leading authorities on .NET).

http://books.google.com/books?id=dSiuGk0RZ4gC&pg=PA43&lpg=PA43&dq=juval+lowy+net
+%22every+class+is+a+binary+component%22&source=web&ots=wxe6jvmsTh&sig=GEsjSwa5v
WhuYHn6LwGtnv3IZcQ#PPA43,M1

Registered User - 12 Oct 2007 17:58 GMT
>> 2 .NET interfaces do not represent any sort of binary standard
>
>You may appreciate this (by one of the world's leading authorities on .NET).
>
>http://books.google.com/books?id=dSiuGk0RZ4gC&pg=PA43&lpg=PA43&dq=juval+lowy+net
+%22every+class+is+a+binary+component%22&source=web&ots=wxe6jvmsTh&sig=GEsjSwa5v
WhuYHn6LwGtnv3IZcQ#PPA43,M1

I'm not certain what I am supposed to be looking at, binary
compatibility wasn't the question. According to MSDN unmanaged code
uses binary standards to ensure type compatibility while type
standards are used in managed code.

http://msdn2.microsoft.com/en-us/library/cwk974ks(vs.80).aspx
or
http://tinyurl.com/2d8mw4

regards
A.G.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.