New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
XPathNodeIterator should implement IEnumerable<XPathNavigator> #14515
Comments
I have a few questions about this. When playing around with implementing this, I noticed that the ApiCompat tool started to fail. My understanding is that even though the GetEnumerator method (
My terminology use may be a bit primitive so I apologize in advance. |
It is a breaking change according to corefx breaking change rules. Consider for example this code: void M(XPathNodeIterator iterator) => PrintType(iterator.GetEnumerator());
void PrintType<T>(T ignored) => Console.WriteLine(typeof(T)); Before the change, it would print Even worse, the method is I think what you need is to leave the existing |
@svick That reference doc for breaking rule changes is incredibly useful. And in general, thanks for your advice on this issue. |
@krwq what is the API shape? Please add formal API proposal (see the example there). |
@karelz, I thought the title was enough but adding for clarity |
@krwq we should probably keep the IEnumerable as explicit interface -- I think there are subtle differences in explicitly / implicitly implemented interfaces. |
@karelz done |
Implementing Am I missing anything? |
FYI: The API review discussion was recorded - see https://youtu.be/dOpH6bUNbcw?t=1567 (8 min duration) |
@karelz Based on the conversation it sounds like the PR should be closed out till the api is approved. Does this sound correct? |
Sounds like a very reasonable plan, if you don't mind. Sorry for the confusion. |
Since the interface has to be implemented explicitly there will be no gain for existing apps from this work and little discoverability for new apps - I will close this issue for now - please reopen/comment if your app/library will gain anything from this work and we will reconsider given new data. |
Currently XPathNodeIterator implements only IEnumerable interface. XPathNodeIterator always iterates over objects of type XPathNavigator and thus every usage ends up with casting back and forth XPathNavigator --> object --> XPathNavigator in a loop. Implementing IEnumerable on this type would allow to avoid this indirection and in cases where iterating is useful improve perf.
cc: @tmat
EDIT 2017/12/28: In PR: dotnet/corefx#26083
Requested API changes:
The text was updated successfully, but these errors were encountered: