Вопрос

I was looking at the source code for the Append function in the SeqModule and noticed that there are a ton of duplicate methods with @xxx postfixed to them. Does anyone know why these are here?

ILSpy Screenshot

Это было полезно?

Решение

In short, those are the concrete classes that back various local function values, and the @xxx values indicate the source code line number that caused them to be generated (though this is an implementation detail, and the classes could be given any arbitrary name).

Likewise, the C# compiler uses a conceptually similar scheme when defining classes to implement anonymous delegates, iterator state machines, etc. (see Eric Lippert's answer here for how the "magic names" in C# work).

These schemes are necessary because not every language feature maps perfectly to things that can be expressed cleanly in the CLR.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top