views:

346

answers:

8

Hi,

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

+2  A: 

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.

Ngu Soon Hui
+2  A: 

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.

Dexter
A virtual machine is not required. One can build a compiler which compiles to native machine code.
Ikke
+6  A: 

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.

lexu
All languages without libraries are practically useless.
mP
+15  A: 

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 ;)

Georg Fritzsche
Well, as Mono is growing really fast, I think we can use it to create more and more "useful" program. :)
Lex Li
If you're at all interested in the good of Linux and free software in general, please do not use C# when you write new programs. Thanks.
Conrad Meyer
+2  A: 

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.

GrayWizardx
A: 

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.

Stephen C
From http://en.wikipedia.org/wiki/Mono_(software)On July 6, 2009, Microsoft announced that it was placing their ECMA 334 and ECMA 335 specifications under their Community Promise pledging that they would not assert their patents against anyone implementing, distributing, or using alternative implementations of .NET[21] which have dispelled the patent concerns over the ECMA portions of Mono.
s_hewitt
However, the Free Software Foundation later reiterated its warnings,[22] claiming that the extension of Microsoft Community Promise to the C# and the CLI ECMA specifications[23] would not prevent Microsoft from harming open source implementations of C#, because many specific Windows libraries included with .NET or Mono were not covered by this promise.
s_hewitt
[21] http://port25.technet.com/archive/2009/07/06/the-ecma-c-and-cli-standards.aspx - [22] http://www.fsf.org/news/2009-07-mscp-mono
s_hewitt
I heard about FSF's voice on this, but if we just use the non Windows specific libraries, we are still free to use Mono.
Lex Li
You are "free" to use Mono. But that doesn't make it a wise ... and community spirited ... thing to do.
Stephen C
+3  A: 

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.

Marc Gravell
Please edit, how many different platforms are truely mentioned in your list.
mP
"cars" and "Zune" also fall under the Compact Framework.
Richard Szalay
+1  A: 

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.

mP