Browsing 7239 questions and answers with Jon Skeet
Unfortunately this is effectively a copy of an existing answer, which was downvoted... but as your comment now indicates that you'd welcome such an option... You can use printf to format your whole string: System.out.printf("Found 0x%02X... more 2/1/2014 6:42:52 PM
You can't, in general. Anything which involves a method call is not going to be a compile-time constant, as far as the compiler is concerned. What you can do is express a double literal using scientific notation though: public const... more 2/1/2014 5:59:33 PM
If you only need an exact match you can use: GetType(T) Is GetType(Rect) If you want to match with inheritance, you can use: GetType(Rect).IsAssignableFrom(GetType(T)) Although to be honest, if you have to handle each subclass... more 2/1/2014 4:55:52 PM
My guess is that you're including the "data:image/png;base64," part at the start of the string - you need to strip that first. You don't need to do anything else - with the text in the pastebin, Convert.FromBase64String handles everything... more 2/1/2014 9:13:07 AM
You almost certainly want to store the data in UTC. You then display the time to the user in their local time zone, so it'll never appear to be in the future. Different people around the world will see different times for the same comment,... more 2/1/2014 9:07:44 AM
I'm not sure what is wrong here but the error implies that it is not receiving any string. No, the error implies that you're trying to create an array with a negative length. That implicates these lines: int length =... more 2/1/2014 8:59:18 AM
Well, if you don't mind the boxing hit, you could use a set which you prepared earlier: // Use a more appropriate name if necessary private static final Set<Integer> VALID_MODES = new HashSet<>(Arrays.asList(1, 2,... more 1/31/2014 9:04:27 PM
If you're happy with a jagged array (an array of arrays) then LINQ makes it fairly easy: XDocument doc = XDocument.Load(...); var array = doc.Root .Elements("Month") .Select(month =>... more 1/31/2014 9:00:45 PM
You're not really trying to order all the car elements - you're trying to order each group of elements. It's probably simplest just to use ReplaceNodes for each difficulty element: foreach (var difficulty in... more 1/31/2014 4:57:20 PM
This is the nasty part, obviously: x += y += x += y; This is executed as: int originalX = x; // Used later x = x + y; // Right-most x += y y = y + x; // Result of "x += y" is the value stored in x x = originalX + y; // Result of "y +=... more 1/31/2014 4:46:10 PM