Browsing 7239 questions and answers with Jon Skeet
If you don't have anything you need to clean up at the end, that's perfectly fine. finally blocks are almost always about resource cleanup... and there are plenty of times where you want to catch an exception but don't have any resources... more 10/4/2015 7:53:15 AM
You've only declared time within the try block, so it's out of scope after that. You could declare it beforehand: DateTime time; try { time = ...; } catch (FormatException) { Console.WriteLine("Wrong date and time format!"); ... more 10/3/2015 9:03:04 AM
Given that you want a Unicode code point of 21, not 15, you should definitely start with the string "15". If you try to start with 15 as an int, you'll find you can't express anything with a hex representation involving A-F... So, given... more 10/2/2015 3:33:31 PM
I suspect the problem is that you're not actually performing the rounding using decimal.Round. Instead, you're expressing it in the query which is being translated into SQL. If you want the rounding to be done in .NET instead, you need to... more 10/2/2015 3:19:47 PM
You should specify the type you want to deserialize to in the call, as a generic type argument: Dim modelList As Models = JsonConvert.DeserializeObject(Of Models)(jsonString) Although you may find that doesn't work, and that you... more 10/2/2015 2:58:19 PM
In the declaration of LinkedList, Item is the name of a type parameter. It only has direct meaning within the LinkedList class itself. When you're declaring your push method and using LinkedList, you'd specify a type argument, i.e. the... more 10/2/2015 1:59:06 PM
Given that you want the Unix timestamp "the given LocalDateTime, in UTC" the simplest approach is just to convert it to a DateTime by specifying the DateTimeZone for UTC, and convert that: LocalDateTime local = new LocalDateTime(2015, 10,... more 10/2/2015 11:42:36 AM
It sounds like Item should be an abstract class then, with getPrice() being an abstract method: public abstract class Item { private final String description; public Item(String description) { this.description =... more 10/2/2015 9:50:43 AM
Section 7.5.3.2 of the C# specification is the relevant part here - "Better function member". The result is more simply demonstrated as: using System; class Test { static void Foo<T>(T item) { ... more 10/2/2015 9:34:42 AM
Logically, I've always felt that an Interval should be between two Instant values rather than two DateTime values. However, the Joda Time API is what it is. When you create an Interval from two DateTime values, the end time is converted... more 10/2/2015 9:01:08 AM