Browsing 7239 questions and answers with Jon Skeet
Unfortunately, GregorianCalendar is badly named. It's actually "Julian / Gregorian calendar, with a switch-over between them." Fortunately, you can use it to act as a pure Gregorian calendar by setting that switch-over to be at the start... more 10/27/2016 8:56:17 AM
Assuming you can't change the method to be generic, you can just use the fact that all value types provide a parameterless constructor, so you can call Activator.CreateInstance: public object GetDefaultValue(object obj) { Type type =... more 10/27/2016 8:40:15 AM
This almost certainly has nothing to do with anything .NET is doing - it'll be the file system transparently caching for you. To test this, change your code to just use FileStream and simply loop over the file reading it to a buffer and... more 10/26/2016 2:52:48 PM
So instead of copying the DLL, use dotnet pack to build a nuget package on your Mac, and copy that to your Linux machine instead. Put it in a directory that you configure as a local nuget repository (no server or anything required) and... more 10/25/2016 6:08:54 PM
m is the parameter to the lambda expression. It will be called with each element in the collection (as far as necessary). This is an inefficient way of writing the code, however. It would be better to use: int regionCode =... more 10/25/2016 5:48:21 AM
What you've described is precisely the behaviour of LocalDateTime.InZoneLeniently in Noda Time 2.0. (Thanks to Matt Johnson's change :) However, as that's still in alpha, here's a solution for 1.3.2. Basically, you just want an appropriate... more 10/24/2016 7:03:02 PM
Okay, so it looks like you want something like this, which loads all the field elements in the Import just-below-root element, then loads the reference lists by finding every element which isn't Import. var doc =... more 10/24/2016 7:20:22 AM
0010000 is an octal literal. This has nothing to do with BigInteger - it's just Java integer literals (JLS 3.10.1): System.out.println(10000); // 10000 System.out.println(0010000); // 4096 From the JLS: A decimal numeral is either... more 10/24/2016 6:48:50 AM
No, you can't. Indexers - and properties in general - can't be generic in C#. You'd have to use a method instead, or just cast in the calling code. more 10/22/2016 8:07:55 AM
One simple option is to have a private overload taking the server parameter - then you can call it recursively: public void myMethod(String args[]) { myMethod(args, "some value"); } private void myMethod(String[] args, String server)... more 10/21/2016 5:54:16 AM