Kefka
Kefka

Reputation: 1705

Is there any real difference in C# for .NET and C# for mono?

I was thinking about teaching myself C#, but all the books I can find are based around the official .NET. I'm a Linux user and so would of course rather my applications run primarily on Mono (although xplatform to .NET would be fine). Would a book geared towards C# on .NET be just as useful for C# on Mono?

Upvotes: 2

Views: 483

Answers (2)

Julien Roncaglia
Julien Roncaglia

Reputation: 17837

Except from small bugs & corner cases that aren't exactly the same Mono follow the C# specification pretty closely and any book about the C# language would apply without problem.

The main differences are in the class library where some parts aren't always implemented in Mono and other parts that are but that you shouldn't use.

Examples are things like WPF (An user interface library) that doesn't exists in Mono or WinForms (The old user interface library) that exists but under linux you should use GTK# instead.

So you should see what your book speak about exactly and choose in function. Some very bad books begin with how to use visual studio and type your first WPF hello world, they are clearly what you don't want as a C# linux programmer.

While the mono project contains good documentation a good way to find if some class is supported is to browse the source on https://github.com/mono/mono/tree/master/mcs/class and if the namespace is either not there or filled with classes throwing NotSupportedException, you know that you can't use it.

If i would recommend a book it would be Mono: A Developer's Notebook it's aimed at people already programming and wanting to learn C# with mono.

Upvotes: 4

bryanmac
bryanmac

Reputation: 39296

The vast majority of any C#/.Net book would apply to Mono/C# on other platforms. They both implement the same spec. Mono Develop is also a good option on other platforms.

Of course anything platform specific in the libraries would be different. For example:

  • Microsoft.* namespace
  • P/Invoke to Win32 APIs
  • COM/COM Interop

Here's a related thread on the topic:

Compatibility of .NET csc and Mono mcs

Upvotes: 2

Related Questions