Pregunta

In .NET if you compile something it is possible to decompile it and see the source code using programs such as Reflector.

I know the basics of Objective C and will rather try to use Objective C than MonoTouch. The reason why I use MonoTouch is because there are some things that I do not know how to do with Objective C.

For example:

 UdpClient client = new UdpClient("192.168.0.120",5050);
 client.Send(new byte[]{0,1,2,3,4},5);

I attempted all day to do those two lines of code with Objective C and I was not able to. Anyways, I was wondering if it would be possible to turn MonoTouch into Objective C just like Reflector does, for the purposing of learning.

¿Fue útil?

Solución

Reflector (and similar tools) works by reading the IL of your compiled code (i.e. assemblies). Then they offer you to decompile this IL into an high level .NET language, e.g. C#, VB.NET, Delphi, F#...

This can be useful since the generated code will often looks like, something close, to the original source code (minus things that are lost because they are not part of the IL, metadata or debugging symbols) and that can be a great learning tool.

This won't work in your case because Objective C is not a .NET language (and AFAIK no one made a .NET version). In theory such tools could show syntax for non .NET languages but, in practice, it would not be very helpful.

Why ? the resulting source code would not compile back into executable code, e.g. all calls to the base class librairies (.NET BCL) won't be found by the Objective C compiler. Since the BCL and the different frameworks that Apple offers (for iOS and OSX) are quite different (e.g. your UdpClient sample code) then it would not really help you learn iOS development.

Note: MonoTouch does not translate C# (or .NET) into Objective C code. The JIT (simulator) or the AOT (devices) compilers will directly emit native (i386 or armv6/7) assembly code.

Otros consejos

There are no tools that I'm aware of to convert MonoTouch C# into Obj-C.

You may want to look at the MT Rosetta Stone, which maps the various MT C# classes and methods to their Obj-C counterparts.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top