开发者

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

开发者 https://www.devze.com 2023-03-25 18:26 出处:网络
how does a c sharp compiler work when a function from anypre-defined namespace is called? I have mentioned System namespace just a开发者_如何学运维s an instance.The same as it does for any other names

how does a c sharp compiler work when a function from any pre-defined namespace is called? I have mentioned System namespace just a开发者_如何学运维s 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号