Browsing 7239 questions and answers with Jon Skeet
are there any rules governing these wrapper classes' assignments Yes - the rules of the JLS. It specifies widening primitive conversions (5.1.2) and boxing conversions (5.1.7). The list of boxing conversions includes: From... more 6/23/2016 6:27:40 AM
From C# 5 onwards you can get the compiler to fill it in for you, like this: using System.Runtime.CompilerServices; public static class Helpers { public static string GetCallerName([CallerMemberName] caller = null) { ... more 6/23/2016 6:04:15 AM
Use LINQ to JSON instead. If you parse it as a JObject, you can iterate over all the properties, and find those which match your regex. Regex regex = new Regex(...); JObject json = JObject.Parse(text); foreach (var property in... more 6/23/2016 5:57:33 AM
No, a Period doesn't record a start/end - it just represents the amount of time between them, in a calendrical sense (rather than the "precise amount of time" represented by a Duration). It sounds like basically you should create your own... more 6/22/2016 5:50:13 PM
Your class library itself should have a framework of netstandard1.3 or whatever version you want - Noda Time is targeting netstandard1.3 for example, as I've found that there's too much missing from netstandard1.0, unfortunately. I'd... more 6/22/2016 4:00:36 PM
Your Tetrominoes enum is nested in Shape. So you could refer to it as: private Shape.Tetronminos[] board; ... but you'd be better off promoting it to a top-level type, in my view. I'd also suggest calling it Tetromino (singular) and... more 6/22/2016 8:46:07 AM
But, when the decimals in the original number is less than 3 decimals, then at the end "1" is appended. Your value of 2.04 isn't really 2.04. It's actually 2.04000000000000003552713678800500929355621337890625, which is the double... more 6/22/2016 8:26:35 AM
Yes, explicit interface implementations can only be invoked on an expression of the interface type, not the implementing type. Just cast the service to the interface type first, or use a different variable: [Fact] public async Task... more 6/21/2016 3:50:44 PM
You're calling Call, which is meant to call an instance method. You want CallStatic, which calls a static method. more 6/21/2016 6:43:23 AM
You've specified one digit of subsecond precision - but you've got three. Use SSS and it's fine: String text = "2011-11-01T13:00:00.000"; DateTimeFormatter formatter =... more 6/21/2016 6:33:27 AM