Browsing 7239 questions and answers with Jon Skeet
If a process exits, all the native resources (network handles, file handles etc) are cleared up by the operating system. I wouldn't expect the using statement to come into effect here - I suspect the OS will kill the threads too hard for... more 9/29/2015 5:53:11 AM
You're ignoring the namespace of the element. Due to the xmlns="...", both the headers and header elements are in a namespace of "http://api.temp.com/ns/". Fortunately, LINQ to XML makes this really easy to fix: XNamespace ns =... more 9/28/2015 3:50:42 PM
You just need a strict ResolverStyle. Parsing a text string occurs in two phases. Phase 1 is a basic text parse according to the fields added to the builder. Phase 2 resolves the parsed field-value pairs into date and/or time objects.... more 9/28/2015 12:53:41 PM
It's not about the "first nested scope" - it's a matter of Java allowing a local variable to hide a field, but not allowing it to hide another local variable. Presumably the designers of Java believed such hiding to be bad for... more 9/28/2015 9:25:12 AM
I have an interface class the contains variables that needs to be implemented by other classes. Interfaces can't contain variables as such - they can only contain constants, so it makes no sense to try to change the value of... more 9/28/2015 8:19:47 AM
You can definitely make this code a lot simpler by using && and just returning the value of equality comparisons, instead of all those if statements and return true; or return false; statements. public override bool Equals (object... more 9/26/2015 3:46:41 PM
You're calling edgesIterator.next() three times for each iteration of the loop in your first snippet, which I'm pretty sure you don't want to do. Just don't do that: while (edgesIterator.hasNext()) { HashMap tmp =... more 9/26/2015 5:21:19 AM
The documentation for File.listFiles() includes: Returns null if this abstract pathname does not denote a directory, or if an I/O error occurs. So it looks like that's what's happening. A path of d:\..\core\files doesn't look like a... more 9/25/2015 1:45:21 PM
You certainly don't need to use GetType(). You could use: int key; var item = combobox.SelectedItem; if (item is KeyValuePair<int, FontFamily>) { key = ((KeyValuePair<int, FontFamily>) item).Key; } else if (item is... more 9/25/2015 12:11:08 PM
You've got a string with length 2 - because the length() property returns the number of UTF-16 code units, not the number of Unicode characters. Bear in mind that a String in Java is really a sequence of UTF-16 code units, not a sequence... more 9/25/2015 11:47:57 AM