Browsing 7239 questions and answers with Jon Skeet
What am I doing here to cause that method to change signatures? A lambda expression doesn't have a type, and is only convertible to compatible delegate and expression-tree types. Therefore the regular IAppBuilder method with (object,... more 1/26/2018 3:42:11 PM
To solve the general case of more elegantly handling multiple if statements which all compare the same value, but to different constants, you'd normally use the switch statement. That would work in this case, but it would still be overkill... more 1/26/2018 1:57:11 PM
Part of the reason that it's slow is that you're reading one byte at a time. That's never a good idea. If you're using Java 9, I'd also suggest using InputStream.transferTo(OutputStream) to make things rather simpler: But no, you don't... more 1/26/2018 12:24:37 PM
The output you've shown is for a debug build. With a release build (or basically with optimizations turned on) the C# compiler generates the same IL you'd have written by hand. I strongly suspect that this is all to make the debugger's... more 1/25/2018 3:01:46 PM
It's not the cast that's the problem - it's that you expect the compiler (or runtime) to pick up on the fact that the cast is to a type that declares a new Data property. This line in RunMe: return (T)vmA.Data; ... will always use the... more 1/25/2018 8:33:47 AM
Is CS0165 guaranteed for such code in C#? Yes, the rules of definite assignment are designed so that a local variable can never be read before it's definitely been written. It's pretty conservative, too - for example: bool... more 1/24/2018 12:38:41 PM
There's an implicit conversion from char to int, and a constant char expression can be used as a constant int expression, which is what you've got. The value of the int is the UTF-16 code unit associated with the char. Here's another... more 1/24/2018 10:06:07 AM
If the compiler has to execute an anonymous type initializer, then it ends up calling the constructor. But in LINQ to Entities - or any other IQueryable-based LINQ provider - the code isn't actually executed... it's just converted into an... more 1/24/2018 9:23:16 AM
The JSON you've shown would be represented by: public class OrderBookResponse { [JsonProperty("bids")] public List<List<string>> Bids { get; set; } [JsonProperty("asks")] public List<List<string>>... more 1/23/2018 3:22:44 PM
The issue is indeed that you're using the "include end date in calculation" in timeanddate.com. The solution isn't to add a day to the period in Noda Time - it's to add a day to the end date before you perform the calculation: Period... more 1/23/2018 2:25:13 PM