Browsing 7239 questions and answers with Jon Skeet
Yes, TIMESTAMP allows precision down to nanoseconds if you want it. If you only need milliseconds, you just want a TIMESTAMP(3) column. Use a java.sql.Timestamp (which again goes down to nanoseconds, if you need it to) on the Java side.... more 6/27/2014 9:31:04 AM
Dictionary<TKey, TValue> also implements the non-generic IDictionary interface, so you can use that: IDictionary d = (IDictionary) o; foreach(DictionaryEntry entry in d) { output[(string) entry.Key] = entry.Value; } Note that... more 6/26/2014 9:43:52 PM
You need the InnerException: catch(Exception ex) { if (ex.InnerException != null) { Console.WriteLine(ex.InnerException.Message); } } This isn't specific to reflection - it's the general pattern for any exception... more 6/26/2014 8:45:43 PM
It sounds like you should just build a dictionary: var dictionary = pairs.ToDictionary(pair => pair.Key, pair => pair.Value); Then you can look up any entry by key very efficiently. Note that this requires that all the keys are... more 6/26/2014 7:01:00 PM
It's been a while since I looked at Code Contracts, but I'd expect that your contract class was never actually instantiated. Instead, the contracts checker will basically suck the code from your contract class into each concrete... more 6/26/2014 4:05:25 PM
What makes you think DateTime allocates objects? It's a value type. No need for a heap allocation, and thus no need for garbage collection. (As TomTom says, if you have hard latency requirements, you'll need a real-time operating system... more 6/26/2014 3:33:40 PM
You're providing the -classpath argument after the class name - so it's just being passed to your main method. You need to provide it before the class name, and include the current directory in the classpath too: $ java -classpath... more 6/26/2014 12:42:24 PM
I'd just use LINQ. That won't "avoid loops" in terms of execution, but it'll avoid a loop in your source code: // 1dArray isn't a valid identifier... var singleArray = jaggedArray.Select(x => x[0]).ToArray(); Note that this relies on... more 6/26/2014 9:42:50 AM
You're specifying MM and dd in your format, which require two digits. Just specify "yyyy/M/d" as the format - that should handle both 1 and 2-digit day/month values. (You can specify multiple formats instead, but in this case you don't... more 6/26/2014 6:15:18 AM
You should just use typeof(T) and typeof(Y) - those will give you the actual generic type arguments. There's no benefit to using reflection here: it's slow and gives you the wrong answers! As far as I'm aware, the generic type arguments... more 6/25/2014 6:45:16 PM