You searched for jon skeet
. We found 71
results in 0.046 seconds.
Despite the various comments, I've seen helper methods like this used quite a bit, for static initialization, and usually found them simpler than alternatives. Of course, it only works when your key and value type are the same - otherwise... more
No, the generic type definition will refer to ICollection<T> specifically, where T is the type parameter for the IList<T>. Imagine you had something like: public class Foo<T1, T2> : IEnumerable<T1>,... more
You're performing three separate computations here. You only need one: var appointment = LocalDateTime.FromDateTime(dateTimePicker1.Value).Date; var retirement = LocalDateTime.FromDateTime(dateTimePicker2.Value).Date; var difference =... more
Just as an additional point to Matt's already-excellent answer, we provide an option for creating an IComparer<Period> with a specific anchor point, e.g. var febComparer = Period.CreateComparer(new LocalDate(2015, 2,... more
Basically, don't use FileReader. It always uses the platform-default encoding, which may well not be appropriate for this file. If you're using a modern version of Java, it's better to use: Path path =... more
Sign extension is happening, but possibly not for the obvious reason, and not in a worrying way, IMO. This code: a |= (short) b; is equivalent to: // No warning here... (surprisingly, given that `a` is being sign-extended...) a =... more
Well, maps are already supported in "protobuf proper" as of v3.0. For example, your proto is effectively: message Dictionary { map<string, string> pairs = 1; } The good news is that with the key and value fields you've... more
There's no such thing as "all possible date formats". A format of "'Year:' yyyy 'Month:' MM 'Day:' dd" would be valid, but highly unusual, for example. There's nothing that Noda Time supplies here that would be particularly helpful. I... more
I wonder whether Action<T> prevents an enclosing class instance to be garbage collected when all other references to such class instance are removed during runtime? No. If the delegate instance were still referenced elsewhere,... more
My question is, why does the compiler choose my Contains() method with non-generic IEnumerable argument over Enumerable.Contains<T>() with IEnumerable<T> argument? Because it's found in the same namespace that contains the... more