You searched for jon skeet
. We found 71
results in 0.323 seconds.
My question is, how does this actually cache the Array variable? The CLR caches it per type argument. Basically, EmptyHolder<int> is a different type to EmptyHolder<string> etc, and the type initializer is invoked... more
The problem is with your Users class. You appear to be expecting it to just pick up the fields, but I don't believe JSONObject does that - instead, it finds bean-like getters. If you try to convert a single instance of your Users class to... more
Yes, that's a fairly common pattern - usually with a bunch of methods with a with prefix. Each with* method "changes" a single field, so you can have: Person jon = new Person("Jon", "Skeet"); Person holly = jon.withFirstName("Holly"); //... more
What does Skeet mean by a static class being both abstract and sealed? I mean that that's the representation in the IL. For example: static class Foo {} Generates IL of: .class public abstract auto ansi sealed beforefieldinit... more
Both are correct singleton implementations. Whether you need the static constructor just depends on how much you care about full laziness. If you really, really don't want the singleton to be instantiated until it's used by a caller, you... more
What you've described simply doesn't happen. The compiler does not create a wrapper array unless it needs to. Here's a short but complete program demonstrating this: using System; class Test { static void MyMethod(params object[]... more
I believe it's to do with the version of the CLR being used. On the CLR prior to v4, the culture information being used did have the time separator as .. On CLR v4+, it's :. I don't know why... presumably CLR v4+ is reading the regional... more
The code you've given has two problems: Optional parameters must come last (apart from params parameters) const fields must be assigned compile-time constants, and string.Empty isn't a const field Because Empty isn't a valid const, your... more
Unless you have code to specifically remember the difference between a property which has been initialized with its default value, and one which hasn't been set at all, you can't tell the difference. I have two suggestions, however: You... more
Is the vector class not synchronized on its own object (this)? Yes, but only for each individual operation. Here we have two operations: if (vector.isEmpty()) vector.add(anElement); It's possible that between the check of... more