Browsing 7239 questions and answers with Jon Skeet
No, you can't do that - but if the important part is to give the arguments meaningful names, you could consider something like: class Foo extends Bar { private static final int DEFAULT_WIDTH = 10; private static final int... more 2/3/2015 1:24:26 PM
When I call this method but return String.Empty instead of the ReadToEnd, the method takes about 500 MS. All that says is that starting to get the response takes 500ms. Calling GetResponseStream doesn't consume all the... more 2/3/2015 10:18:15 AM
No, they're not exactly the same. try-with-resources statements can declare multiple variables of different types; using statements can declare multiple variables, but they all have to be of the same type A using statement doesn't have... more 2/3/2015 8:11:09 AM
Downloading just a single URL to a file is dead easy using WebClient: using (var client = new WebClient()) { client.DownloadFile(url, filename); } The trickier bit is that very few web pages really consist of a single piece of HTML... more 2/3/2015 7:22:13 AM
What is the point of using TreeSet in this situation for sorting data if i am also providing a custom Comparator to it ? Because it's the TreeSet code that keeps it sorted. You haven't had to provide any of the code for that - all... more 2/2/2015 7:16:15 PM
You can use toArray(), then the String(int[], int, int) constructor. This isn't entirely satisfactory as chars() is specified to return UTF-16 code units, basically: Returns a stream of int zero-extending the char values from this... more 2/2/2015 3:16:11 PM
Firstly, as noted in comments, any time you can work with an exclusive upper bound, that would be a good idea :) Your AtEndOfDay method looks reasonable to me, except that I'd use Duration.Epsilon instead of Duration.FromTicks. In... more 2/2/2015 11:36:07 AM
I would use the overload of parse which takes a ParsePosition - you can then check the position afterwards: import java.util.*; import java.text.*; public class Test { public static void main(String[] args) throws Exception { ... more 2/2/2015 8:49:33 AM
There are various options for this. Given that your method can only return int, there aren't very many options available, so you could just write: private static final int[] results = { 9, 99, 999, 9999, ... }; public static int... more 2/2/2015 7:19:19 AM
System.Data.DataSetExtensions is an assembly, not a namespace. You just need to add a reference to System.Data.DataSetExtensions.dll (as you say you already have) and then a using directive for the System.Data namespace: using... more 2/1/2015 9:02:58 PM