Browsing 7239 questions and answers with Jon Skeet
Whats the difference between matrix.Extension() and ExtensionMethods.Extension(matrix)? Nothing whatsoever. The compiler translates the first into the second, effectively. There will be a difference in C# 6, where if you've... more 8/12/2014 1:41:38 PM
(I realize this is an old question, but...) This is relatively painful to do in pure .NET. I'd recommend my own Noda Time library, which is particularly designed for things like this: LocalDate start = new LocalDate(2009, 10,... more 8/12/2014 12:24:34 PM
You need to be selecting the fThrust element within the inner item, not the outer one - just as you're already doing for HandlingType: Thrust = (decimal?) i.Element("SubHandlingData") .Element("Item") ... more 8/12/2014 10:37:16 AM
There's no difference in behaviour whatsoever - but the latter is distinctly unidiomatic. I've previously seen it as a sign that the author seems to think that return is a function call, or at least want to treat it as such. (Sometimes... more 8/12/2014 8:42:34 AM
If the offset is not important, I suggest you just truncate the string after the time. It looks like the format should allow that by finding the first space after position 16 (the start of the time in your example; part way through the... more 8/12/2014 8:18:34 AM
This code is a bit more long-winded than it needs to be - I'd do most of the work in the "local" context, and only convert back to the time zone when you know the LocalDateTime you want to map. var now = clock.Now.InZone(zone); // Change... more 8/12/2014 6:18:32 AM
If your method is deciding the response entity type, I suspect your method shouldn't be generic in the first place: public ResponseEntity<?> foo() { if (condition1) { return new InfoResponseEntity<Info>(new... more 8/12/2014 6:06:21 AM
what if there's a thread interruption right between the openResource()-call and entering the try-clause? Then the thread won't throw an InterruptedException until it hits some blocking call. That can't happen before it gets into the... more 8/11/2014 8:19:10 PM
What explains this behavior? The C# 5 specification, section 7.14: The second and third operands, x and y, of the ?: operator control the type of the conditional expression. If x has type X and y has type Y then [...] ... more 8/11/2014 6:59:46 PM
I have read how Date returns the Millis from the Epoch but I would expect that it would return the millis from the Epoch of the date I ask from the Calendar. Then your expectation is incorrect - or you're not expressing your... more 8/11/2014 6:12:03 PM