Browsing 7239 questions and answers with Jon Skeet
The conversion data between Windows time zone IDs and IANA time zone IDs is available via CLDR. Looking at the data (and at the raw IANA data in Github) it looks like the IANA time zones in question are: "America/Godthab" (West... more 4/1/2018 4:33:01 PM
Is there any way to constrain a generic method for classes which are defined inside a static class? No, there isn't. The only type constraints are: Requiring a public parameterless constructor (where T : new()) Requiring it to be a... more 3/30/2018 9:07:52 AM
It sounds like you're looking for ThreadLocal<T>, but I'd generally be careful about using this - it can lead to code where the interaction between two classes is hard to reason about, and it limits how you work with threads later... more 3/29/2018 10:44:56 AM
You can use DateTimeFormatInfo.ShortDatePattern to get the pattern, and then replace d with dd if you really want to. You might need to consider corner cases such as escaped or quoted d patterns though - as well as obviously not replacing... more 3/27/2018 2:25:54 PM
I think you're just looking for a class literal: @Override public Class<BikeModel> GetReturnType() { return BikeModel.class; } more 3/27/2018 11:47:50 AM
An API key could only work when accessing the resources owned by the project that created the key. For resources like spreadsheets, you're typically accessing resources owned by a user. It would be pretty awful if you got access to my... more 3/27/2018 11:26:28 AM
DateTime.Now.Date.AddDays(-1).AddHours(13) will return 1pm... but you're checking against new FileInfo(file).CreationTime.Date, which is always at midnight... for a file created yesterday, it will be yesterday at midnight. So yes, you're... more 3/27/2018 11:07:58 AM
Noda Time 2.x only supports the Target Framework Monikers netstandard1.3 and net45. There's no direct PCL support, although some environments that traditionally used PCLs now support .NET Standard. The 1.x series supports PCLs via... more 3/27/2018 5:37:15 AM
Isn't DoIt() signature compatible with Func<string, int>? Yes it is. It's fine to convert it to that specific type, like this for example: Func<string, int> func = DoIt; var cachedDoit = Memoize(func); The problem... more 3/23/2018 9:27:12 AM
For the most part, you can ignore this detail. But if you look through the specification, you'll see various place that the language considers conversions from type X to type Y. There are other places that the language considers... more 3/23/2018 6:05:28 AM