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 toglobal::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.
精彩评论