Browsing 7239 questions and answers with Jon Skeet
This line is broken for any string with a length other than 1: value = result.substring(result.length()-1).charAt(result.length()-1); Consider different lengths: 0 (result is an empty string): result.substring(result.length() - 1)... more 5/15/2014 11:11:04 AM
You're currently reading a byte at a time, because you're using InputStream. That's the first thing to fix - you should be using a Reader for text data. The best approach is to wrap your InputStream in an InputStreamReader. Next, it... more 5/15/2014 10:08:14 AM
The BufferedWriter isn't the problem - it's the way you're constructing the FileWriter. You can simply use the constructor overload which takes an append parameter: new FileWriter("./Cat Info.txt", true) Personally I would avoid using... more 5/15/2014 9:31:21 AM
This looks like it works... basically ToBinary just returns a representation where the bottom 58 bits are the ticks since the BCL epoch in UTC. This code just reverses that private static final long UNIX_EPOCH = 62135596800000L; public... more 5/15/2014 6:25:13 AM
You won't get anything from Intellisense precisely because you've got a List<dynamic>. You're saying, "I don't know at compile-time what this list will contain. When I access members of the elements, just bind that dynamically at... more 5/15/2014 6:09:13 AM
My takeaway from the "async and await keywords don't cause additional threads to be created" is that it simply uses threads already created from the thread pool No, that's not true at all. async and await don't use the thread pool at... more 5/15/2014 5:55:24 AM
The simplest approach would be to take several separate parameters, and create the Field instance based on those parameters. You can only configure attributes with compile-time constants, and new Field(...) isn't a compile-time... more 5/14/2014 4:33:19 PM
I would go with throwing an exception - it indicates that the world is not in a state you expect, and you'd be better off quitting before you do any damage: if (y == 0) { x = 1; } else if (y == 1) { x = 2; } else { throw new... more 5/14/2014 4:20:20 PM
There's no such thing as "the empty string character". A character is always a UTF-16 code unit, and there's no "empty" code unit. There's "an empty string" which is represented exactly the same way as any other string: A char[]... more 5/14/2014 3:07:48 PM
I suspect the simplest approach is to create a List<string> for the street names you're searching for first - I would expect those to be convertible: var searchedStreets = searchedAddresses.Select(x => x.StreetName).ToList(); var... more 5/14/2014 1:51:20 PM