Browsing 7239 questions and answers with Jon Skeet
You need to convert from DBNull.Value to the null value of DateTime?. It may be simplest to write an extension method on DbDataReader for that: public static DateTime? GetNullableDateTime(this DbDataReader reader, ... more 10/26/2013 1:52:50 PM
I suspect it hasn't frozen - it's just waiting for input. Unfortunately it hasn't told you that it's waiting for input due to the ordering of these two statements: int input = keyboard.nextInt(); out.println("If you want to add an item,... more 10/26/2013 9:45:47 AM
Plain hashmaps are inherently unordered. You can't sort them, or assume anything about the order in which the entries are retrieved when iterating over them. Options: Use a TreeMap if you want to sort by key. Use a LinkedHashMap if you... more 10/26/2013 9:24:06 AM
The exception message shows that you've used Blog and Post as classes nested within Program, whereas the instructions state: Below the Program class definition in Program.cs add the following two classes. Personally I'd put them into... more 10/26/2013 8:40:57 AM
Sounds like you just want: var priorities = ((Models.Priority[]) Enum.GetValues(typeof(Models.Priority))) .OrderByDescending(x => x); Or to avoid quite as many brackets: var priorities =... more 10/25/2013 8:54:26 PM
The Integer part is inferred from the usage of the result of the constructor call - it's assigning to a variable of type MyClass<Integer>, hence the Integer part is inferred for the diamond. The constructor argument is irrelevant to... more 10/25/2013 3:48:58 PM
You shouldn't include the value directly in your SQL at all. Instead, use parameterized SQL, such as: Cursor cursor = db.rawQuery("SELECT * FROM category WHERE name=?", new String[] { a }); That way: You... more 10/25/2013 3:45:10 PM
LINQ can do this very easily returning a single lookup collection: var lookup = list.ToLookup(x => x.GetType()); You can then: Iterate over it to find all the types and the associated objects Fetch all the items of a specific type... more 10/25/2013 1:25:35 PM
This is the problem, I believe (in the original code in the question): public void Serialize(Stream outputStream, T3 content) { using (var stream = new MemoryStream()) { Serializer.Serialize(stream, content); ... more 10/25/2013 1:21:41 PM
There's mapping information between Windows time zone IDs and IANA IDs in CLDR - it's reasonably easy to read the XML, and you may well find there's a Java library around to parse this for you. However, it's worth being aware that the... more 10/25/2013 12:38:41 PM