Re: Why this code does not cause error in .NET 2 & 3.5 (bug?)
- From: Jon Skeet [C# MVP] <skeet@xxxxxxxxx>
- Date: Mon, 3 Dec 2007 07:38:26 -0000
Andrus <kobruleht2@xxxxxx> wrote:
No. From the docs for XmlDocument.SelectNodes:
<quote>
An XmlNodeList containing a collection of nodes matching the XPath
query. The XmlNodeList should not be expected to be connected "live" to
the XML document. That is, changes that appear in the XML document may
not appear in the XmlNodeList, and vice versa.
</quote>
As I understand, this code may work in some cases and in some other cases
(like using other data or other version of .NET) it may cause exception.
Yes. In other words, you shouldn't depend on it working either way.
Why .NET allows to use such broken code ?
I don't see it as being particularly broken.
Has java 6 also such kind on desing flaw or is it better designed ?
There are many ways in which .NET is better designed than Java. There
are a few examples the other way round, of course, but generally I
prefer the design of .NET.
--
Jon Skeet - <skeet@xxxxxxxxx>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
World class .NET training in the UK: http://iterativetraining.co.uk
.
- References:
- Re: Why this code does not cause error in .NET 2 & 3.5 (bug?)
- From: Andrus
- Re: Why this code does not cause error in .NET 2 & 3.5 (bug?)
- From: Bill Butler
- Re: Why this code does not cause error in .NET 2 & 3.5 (bug?)
- From: Andrus
- Re: Why this code does not cause error in .NET 2 & 3.5 (bug?)
- From: Jon Skeet [C# MVP]
- Re: Why this code does not cause error in .NET 2 & 3.5 (bug?)
- From: Andrus
- Re: Why this code does not cause error in .NET 2 & 3.5 (bug?)
- Prev by Date: Re: Design Patterns
- Next by Date: Re: Simple question about c-tor and initializing
- Previous by thread: Re: Why this code does not cause error in .NET 2 & 3.5 (bug?)
- Next by thread: How to get 'Graphics' of the whole screen?
- Index(es):
Relevant Pages
|
Loading