Browsing 7239 questions and answers with Jon Skeet
It you know that callers are only primarily going to use another indexer, you can introduce a generic class providing that: public class SpecializedTable<T> { private readonly DtaTable table; // Just in case anyone really... more 9/24/2015 2:25:36 PM
I've managed to get consistent results by not using CspParameters at all, but using the PrivateKey property of X509Certificate2. My current "portable" implementation unfortunately requires a cast which makes me nervous, but it does appear... more 9/24/2015 1:04:22 PM
Yes, it's guaranteed to be executed from left to right - or at least, act as if it is. This is defined in JLS 15.7: The Java programming language guarantees that the operands of operators appear to be evaluated in a specific evaluation... more 9/24/2015 7:28:19 AM
Well presumably Request.QueryString["data"] is null. You're currently checking whether it's a reference to an empty string, but not whether it's a null reference. I suspect you want to use string.IsNullOrEmpty to check that: string json =... more 9/24/2015 6:32:53 AM
When the type is initialized, all the static initializers and all the static field initializers are executed, in textual order. From JLS 12.4.2: Next, execute either the class variable initializers and static initializers of the class,... more 9/24/2015 5:49:54 AM
Yes, you're calling the method via reflection. So as per the documentation, a TargetInvocationException will be thrown if the target method throws an exception. Just use the InnerException property to obtain - and potentially throw - the... more 9/23/2015 1:57:31 PM
If you're content to just flatten the IEnumerable<IEnumerable<Guid>> into an IEnumerable<Guid> in the obvious way, then SelectMany is your friend: IEnumerable<Guid> labelAgentIds = labelGroups.SelectMany(x =>... more 9/23/2015 11:52:49 AM
Java streams in Java 8 make this pretty easy - the Stream.anyMatch method taking a predicate is exactly what you want. In this case you can use a method reference to create a predicate from the check() method. public boolean... more 9/23/2015 11:40:56 AM
Basically .NET calendar code doesn't support cutovers between the Gregorian calendar and the Julian calendar... and even if it did, I wouldn't really expect it to support the oddities of the Swedish situation, which didn't follow either of... more 9/23/2015 10:39:38 AM
No, it's not equivalent - because Version overloads the == operator. The snippet which casts the left operand to Object is equivalent to: if (Object.ReferenceEquals(version, null)) ... rather than calling the operator== implementation... more 9/23/2015 10:04:53 AM