简体   繁体   中英

how does a c sharp compiler work when a function from the system namespace is called?

how does ac sharp compiler work when a function from any pre-defined namespace is called? I have mentioned System namespace just as an instance.

The same as it does for any other namespace. There is no magic here.

There are some hard-coded things in the compiler, for example:

  • the type aliases int / string etc which are merely aliases to global::System.Int32 etc
  • the expression tree compiler is, AFAIK, hard-coded to System.Linq.Expressions.Expression (but is also not cited in the spec, so a bit of an edge-case)
  • some magic in the interop namespaces (for calling constructors on interfaces, etc)

But mostly... it is just classes etc.

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