单是否实现CLR?或至少​​一些非网管型InternalCall?或没有?网管、CLR、InternalCall

2023-09-06 05:02:25 作者:久腻°

我们知道,C#中使用非托管code一样的P / Invoke或CLR实现code像InternalCall。我想知道的是做单就自我实现了一个完整的CLR或只是一些非托管的code或什么?   我可以使用的.Net Reflactor或ILSpy查看托管程序集,但是由于性能问题,有些时候我需要知道如何CLR实现一些非托管code。像:如何System.String.get_lenght()呢?   任何人可以回答上面的问题或有关这方面的一些信息来源是值得欢迎的。谢谢你。

We know that C# uses unmanaged code like P/Invoke or CLR implemented code like InternalCall. What I want to know is does mono it self implements a complete CLR or just some unmanaged code or nothing? I can use .Net Reflactor or ILSpy to view managed assembly, but some times due to performance issues I need to know how does CLR implement some unmanaged code. Like: How does System.String.get_lenght() do? Any one can answer questions above or some infomation about this is welcomed. Thanks.

推荐答案

是的,单就实现整个CLR,所以如果你看它的code,你会发现方法的实施如 String.get_Length()

Yes, mono does implement the whole CLR, so if you looked at its code, you would find the implementation of methods like String.get_Length().

但是Mono是一个不同的实施比微软的CLR。如果你看看了$ C $下这也就意味着String.get_lenght()在单声道那么微软CLR可能做同样的事情的方式完全不同。

But Mono is a different implementation than the Microsoft CLR. What that means is if you look up the code for String.get_lenght() in Mono then the Microsoft CLR could have completely different way of doing the same thing.

另一种方法是看共享源代码公共语言基础。这是微软和它可能更接近于其执行CLR比单声道的,但它仍然是不一样的。而最新的可用版本对应的.NET 2.0。

Another option is looking at Shared Source Common Language Infrastructure. It's from Microsoft and it's probably more similar to their implementation of CLR than Mono, but it still isn't the same. And the newest available version corresponds to .Net 2.0.