Browsing 7239 questions and answers with Jon Skeet
Okay, so I think I know why this is happening - but not a decent fix for it. The documentation for Parse says: When parsing a time with a zone offset like -0700, if the offset corresponds to a time zone used by the current location... more 6/9/2015 7:48:33 PM
It's not just IEnumerable<T> - you can cast it to the array type as well, so long as you fool the compiler first: public enum Foo : short { A, B } class Test { static void Main() { Foo[] foo = new Foo[10]; ... more 6/9/2015 7:08:52 PM
Yes, String was changed significantly in Java 7 update 6 - now separate String objects never share an underlying char[]. This was definitely a trade-off: Strings no longer need to maintain an offset and length (saving two fields per... more 6/9/2015 6:13:27 PM
You're performing 32-bit integer arithmetic, as every operand in 24 * 60 * 60 * 1000 * 1000 is an int... but the result is bigger than Integer.MAX_VALUE, so it's overflowing (just as you suspected). (This is actually happening at... more 6/9/2015 5:39:21 PM
You'll get this if you're using a machine that only has .NET 2.0 or .NET 3.0 installed, and thus only a C# 2 compiler. This code: var symmetricKey = new RijndaelManaged() { Mode = CipherMode.CBC, ... }; ... uses an object initializer... more 6/9/2015 5:37:38 PM
You either need to override Equals in Foo, or implement an IEqualityComparer<Foo> so that Except can tell when two Foo values are equal. For example: public sealed class FooComparer : IEqualityComparer<Foo> { public bool... more 6/9/2015 9:09:47 AM
You're asking for the JToken associated with the configurator key. There is such a token - it's a null token. You can check this with: if (configurator.Type == JTokenType.Null) So if you want to throw if either there's an explicit null... more 6/8/2015 10:15:01 AM
Equals / GetHashCode aren't designed to compare things which are "mostly equal". Equality is just a Boolean property in this case. In particular, having a fuzzy "mostly equal" approach leads to problems with transitivity. The documentaiton... more 6/8/2015 8:12:39 AM
I think your question really goes a long way beyond plain implementation of hashCode - it's really about the design of when two IDs should be considered equal. If you have multiple fields all of which are unique, you're actually in a... more 6/8/2015 6:22:57 AM
Yes, absolute - because var isn't actually a type. It just tells the compiler: "I'm not going to explicitly tell you the type - just use the compile-time type of the right-hand operand of the assignment operator to work out what type the... more 6/7/2015 11:36:23 AM