简体   繁体   中英

Why are anonymous methods not supported in .Net 1.1?

I've been learning a lot about IL recently with my new job. I have a question though that I can't quite find an answer for.

All of the documentation I've seen indicates that anonymous methods(for use in delegates) isn't supported on .Net 1.1. However, in the IL, anonymous methods appears to be implemented by just using regular methods with "impossible" names.

So what about anonymous methods makes them unsupported on .Net 1.1? Is there something I'm missing?

So what about anonymous methods makes them unsupported on .Net 1.1? Is there something I'm missing?

The compilers that target .Net 1.1 did not support this, so there was no way to create one in the 1.1 version of the Framework.

A custom language or compiler could, of course, make a version of anonymous methods - but nothing did at the time.

I think the documentation is misleading. What it should state is that anonymous methods are not supported in early versions of the managed languages (VB, C#, C++/CLI).

As you have discovered, there is no notion of an anonymous method in IL; it is up to the language to make them anonymous (by hiding them with mangled names).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM