473,322 Members | 1,566 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Interface in .NET -- mutable or not?

gz
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

Oct 11 '07 #1
8 1806
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

"gz" wrote:
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

Oct 11 '07 #2
On Oct 11, 12:59 pm, gz <zyzhu2...@gmail.comwrote:
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
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.

Oct 11 '07 #3
gz
On Oct 11, 2:45 pm, Peter Bromberg [C# MVP]
<pbromb...@yahoo.yohohhoandabottleofrum.comwrote :
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

"gz" wrote:
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- Hide quoted text -

- 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

Oct 11 '07 #4
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

*** Sent via Developersdex http://www.developersdex.com ***
Oct 11 '07 #5
On Thu, 11 Oct 2007 17:59:28 -0000, gz <zy*******@gmail.comwrote:
>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.
Oct 12 '07 #6
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=dSi...3IZcQ#PPA43,M1
Oct 12 '07 #7
"Jeff Louie" <an*******@devdex.comschrieb im Newsbeitrag
news:Oc****************@TK2MSFTNGP02.phx.gbl...
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

Oct 12 '07 #8
On Fri, 12 Oct 2007 08:32:53 -0400, "Larry Smith"
<no_spam@_nospam.comwrote:
>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=dSi...3IZcQ#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/lib...ks(vs.80).aspx
or
http://tinyurl.com/2d8mw4

regards
A.G.
Oct 12 '07 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
by: Gordon Airport | last post by:
Has anyone suggested introducing a mutable string type (yes, of course) and distinguishing them from standard strings by the quote type - single or double? As far as I know ' and " are currently...
50
by: Dan Perl | last post by:
There is something with initializing mutable class attributes that I am struggling with. I'll use an example to explain: class Father: attr1=None # this is OK attr2= # this is wrong...
18
by: Markus.Elfring | last post by:
The C++ language specification provides the key word "mutable" that is not available in the C99 standard. Will it be imported to reduce any incompatibilities?...
12
by: Kjetil Kristoffer Solberg | last post by:
What is a mutable struct? regards Kjetil Kristoffer Solberg
8
by: hex | last post by:
Hi I make a class "MyClass" and this clas implements the Interface ICloneable. I want when I instance an object from MyClass and I call obj.Clone() it returns an object of MyClass type. for...
12
by: Water Cooler v2 | last post by:
Are JavaScript strings mutable? How're they implemented - 1. char arrays 2. linked lists of char arrays 3. another data structure I see that the + operator is overloaded for the string class...
12
by: Vincent RICHOMME | last post by:
Hi, I am currently implementing some basic classes from .NET into modern C++. And I would like to know if someone would know a non mutable string class.
2
by: subramanian100in | last post by:
I am reading David Musser's "STL Tutorial and Reference Guide" Second Edition. In that book, on pages 68-69, definition has been given that "an iterator can be mutable or constant depending on...
24
by: Steven D'Aprano | last post by:
Sometimes it seems that barely a day goes by without some newbie, or not- so-newbie, getting confused by the behaviour of functions with mutable default arguments. No sooner does one thread...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.