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.
Asked
Active
Viewed 1,263 times
2
-
4It implements the CLR. Looking at the code is not an issue, Mono is Open Source. – Hans Passant Feb 17 '12 at 01:47
-
@Hans : I just got the mono code. Is it possible to ask which directory should I look into? – chenwq Feb 17 '12 at 01:57
-
1Yes, reflector works on mono assemblies, they are the same binary format ( which is the whole idea really ). – IanNorton Feb 18 '12 at 09:22
-
Mono's System.String is implemented here: https://github.com/mono/mono/blob/master/mcs/class/corlib/System/String.cs - the Length property is not an icall. – jstedfast Feb 18 '12 at 22:54
-
Is it more correct to say Mono implements the CLI, than it implements the CLR? – barlop Jul 20 '14 at 14:09
1 Answers
4
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()
.
But Mono is a different implementation than the Microsoft CLR. What that means is if you look up the code for String.get_Length()
in Mono then the Microsoft CLR could have completely different way of doing the same thing.
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.
-
I know that mono is not Microsoft. But a reference is way much better than nothing. I'm searching the mono code, still looking for it. – chenwq Feb 17 '12 at 02:01
-
Will the upcoming .Net core 1.0 use Mono underneath for its CLR related job? – RBT Jun 03 '16 at 07:18
-
Nitpick: Should your second reference to `String.get_lenght()` actually be `String.get_Length()`? If no, can you please explain why? – kevinarpe Oct 17 '16 at 06:13
-
1