CLR implementation of virtual method calls to interface members

That article is more than 10 years old, and a lot has changed since then. IVMaps have now been superseded by Virtual Stub Dispatch. Virtual stub dispatching (VSD) is the technique of using stubs for virtual method invocations instead of the traditional virtual method table. In the past, interface dispatch required that interfaces had process-unique … Read more

What does —-s mean in the context of StringBuilder.ToString()?

The source code for the published Reference Source is pushed through a filter that removes objectionable content from the source. Verboten words are one, Microsoft programmers use profanity in their comments. So are the names of devs, Microsoft wants to hide their identity. Such a word or name is substituted by dashes. In this case … Read more

Are static indexers not supported in C#? [duplicate]

No, static indexers aren’t supported in C#. Unlike other answers, however, I see how there could easily be point in having them. Consider: Encoding x = Encoding[28591]; // Equivalent to Encoding.GetEncoding(28591) Encoding y = Encoding[“Foo”]; // Equivalent to Encoding.GetEncoding(“Foo”) It would be relatively rarely used, I suspect, but I think it’s odd that it’s prohibited … Read more

Instantiation of recursive generic types slows down exponentially the deeper they are nested. Why?

Accessing a new type causes the runtime to recompile it from IL to native code (x86 etc). The runtime also optimizes the code, which will also produce different results for value types and reference types. And List<int> clearly will be optimized differently than List<List<int>>. Thus also EmptyStack<int> and NonEmptyStack<int, EmptyStack<int>> and so on will be … Read more

Why doesn’t the CLR always call value type constructors

The Microsoft C#4 Spec has changed slightly from previous versions and now more accurately reflects the behaviour that we’re seeing here: 11.3.10 Static constructors Static constructors for structs follow most of the same rules as for classes. The execution of a static constructor for a struct type is triggered by the first of the following … Read more

Why are sealed types faster?

At the lowest level, the compiler can make a micro-optimization when you have sealed classes. If you’re calling a method on a sealed class, and the type is declared at compile time to be that sealed class, the compiler can implement the method call (in most cases) using the call IL instruction instead of the … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)