deeps_rule
deeps_rule

Reputation: 339

Is C# platform neutral?

Today I purchased C# 3.0 Pocket Reference (O'Reilly Publishers).

In that book in the first para of the first page it is given that "The C# language is platform neutral, but it was written to work well with Microsoft .Net platform"

If I am not wrong, Platform Neutral mean that the softwares made from that language should run in all the OS(e.g.Mac, Windows,Linux etc.).

I know that this characteristic is being satisfied by Java but .Net has not yet been able to do that(Though MONO has made some progress in Linux).

Then what is the significance of that word "PLATFORM NEUTRAL" so far c# is concern?

Thanks in advance

Upvotes: 14

Views: 10718

Answers (8)

mP.
mP.

Reputation: 18266

Before answering the question, one must consider that any language these days is useless without its libraries. That said many namespaces that make up part of are windows only. Many are just wrappers around microsoft technologies, like com, win forms, etc.

All things considered just take a look at the adjustments mono has made to provide alternatives to dot net. Miguel has mentioned many times that they hope Silverlight will win rather than other ui toolkits because it is truely platform independent rather than wpf and winforms etc.

If you want a true multi platform language and environment look at Java.

Upvotes: 1

Marc Gravell
Marc Gravell

Reputation: 1062610

Don't forget you can use C# in:

  • MS .NET (Windows)
  • .NET Compact Framework (PocketPC, XBox 360)
  • Silverlight (Windows, Mac)
  • Moonlight (Mono / Linux)
  • MonoTouch (iPhone)
  • MonoDevelop (various including android)
  • Micro Framework (some watches etc)

Not exactly bad coverage. The language has very few requirements on the runtime / OS.

Upvotes: 6

Stephen C
Stephen C

Reputation: 718758

In my view, Microsoft's claim that C# is platform neutral (repeated by the text you are quoting from) is disingenuous.

It is technically correct, but in practice the limited portability of C# applications to non-MS operating systems has happened despite Microsoft rather than because of them. It is pretty clear that Microsoft has no intention of supporting C# / .Net on any non-MS operating system. Indeed, many people think that Microsoft (via its patent licensing deal with Novell) is using C# / Mono as a "wedge" to damage the GNU / Linux ecosystem.

IMO, anyone thinking of using Mono needs to consider: 1) the risks to their project if MS decides to play hardball about .NET patents, and 2) the damage they might be doing to the open-source ecosystem as a result.

Upvotes: 0

GrayWizardx
GrayWizardx

Reputation: 21111

C# the language can be implemented on any platform which has a compatible compiler and virtual machine. The language itself has an ECMA standard for implementation, and thus does not itself contain any platform (i.e. Microsoft) specific language elements.

Upvotes: 2

Georg Fritzsche
Georg Fritzsche

Reputation: 98984

The C#-language itself is platform neutral like C and C++ are - you can implement a compiler et al for it on any platform.

The .Net platform and its associated libraries however, which it was designed to work well with, are not platform neutral in design - they are designed to work on windows, although Mono does compensate somewhat for that.

If you would write a C# program without using any features of any .Net-library it is guaranteed to be platform-independent - you can be sure it will run on any platform that has tools for C#... you just won't have a particularly useful program though ;)

Upvotes: 19

lexu
lexu

Reputation: 8849

C#, the language, is platform neutral.

But the frameworks usually associated with C#, the dotNEt environment, are not. They run on Microsoft's OS-es.

Mono enables C# on many other (mostly unix-oid) platforms by providing the necessary runtime environment, but it doesn't come with (all) the frameworks needed to run typical C# programs.

Upvotes: 9

Dexter
Dexter

Reputation: 18452

In this case, platform neutral is defined as "being able to run on any machine that has a compatible virtual machine". Depending on what language features and compiler you use, C# could be considered able to run on machines running recent versions of Windows, Mac OS and Linux.

Upvotes: 2

Graviton
Graviton

Reputation: 83254

C# is platform neutral in the sense of OS (i.e., OS neutral) if you count Mono as a reliable runtime on Linux.

But, C# and .Net can run as it is, without recompilation, on both 32 and 64 bit machine. I guess this is the meaning of the author.

Upvotes: 3

Related Questions