tags:

views:

194

answers:

5

Hello,

May I know what is the different between C# and .Net? because when I think of C#, right away I would say is a .Net, but when I seearch for job, posts sometimes say require candidate to have C# and .Net experience. Can someone give me little of explaination?

thanks..

+25  A: 

C# is a programming language, .NET is a blanket term that tends to cover both the .NET Framework (an application framework library) and the Common Language Runtime which is the runtime in which .NET assemblies are run.

Microsoft's implementation of C# is heavily integrated with the .NET Framework so it is understandable that the two concepts would be confused. However it is important to understand that they are two very different things.

Here is a class written in C#:

class Example { }

Here is a class written in C# that explicitly uses a .NET framework assembly, type, and method:

class Example
{
    static void Main()
    {
        // Here we call into the .NET framework to 
        // write to the output console
        System.Console.Write("hello, world");
    }
}

As I mentioned before, it is very difficult to use Microsoft's implementation of C# without using the .NET framework as well. My first Example implementation above even uses the .NET framework (implicitly, yes, but it does use it nonetheless) because Example inherits from System.Object.

Also, the reason I use the phrase Microsoft's implementation of C# is because there are other implementations of C# available.

Andrew Hare
+1 So often people misunderstand that
Oskar Kjellin
@Bopha - you're making an apples and oranges comparison. C# is .NET, just as VB is .NET, or F#.
Tejs
@Tejs - Actually, VB.NET is .NET. VB isn't.
Eric Mickelsen
Perhaps the difference between the two becomes even more obvious as soon as other .NET-based programming languages enter the stage: there's VB.NET, F#, J#, IronPython, IronRuby, and I hear even COBOL made it to the .NET platform.
stakx
+1 Andrew Hare.@Tejs: Both C# and VB are heavily integrated to .NET, it is not .NET. .NET is a framework. As per instance, you can do .NET in Delphi. If C# is .NET, then you would be able to code C# in Delphi .NET, which is clearly not doable and even unconceivable.
Will Marcouiller
@tehMick Details, Details... =D
Tejs
Similarly, there's no reason you have to have .NET to program in C#, although I don't know of anybody who writes C# without either .NET or Mono.
David Thornley
awesome! thanks.
Bopha
+5  A: 

C# is a programming language, .NET is the framework that the language is built on.

kekekela
+1  A: 

In .NET you don't find only C#. You can find Visual Basic for example. If a job requires .NET knowledge, probably it need a programmer who knows the entire set of languages provided by the .NET framework.

Maurizio Reginelli
you're absolutely right and thanks for the headup. Although I only mention C# in this question, but in that particular job post, it mentions VB as well..
Bopha
+2  A: 

C# is a language, .NET is an application framework. The .NET libraries can run on the CLR and thus any language which can run on the CLR can also use the .NET libraries.

If you are familiar with Java, this is similar... Java is a language built on top of the JVM... though any of the pre-assembled Java libraries can be used by another language built on top of the JVM.

Polaris878
+4  A: 

In addition to what Andrew said, it is worth noting that:

  • .NET isn't just a library, but also a runtime for executing applications.
  • The knowledge of C# implies some knowledge of .NET (because the C# object model corresponds to the .NET object model and you can do anything interesting in C# just by using .NET libraries). The opposite isn't necessarily true as you can use other languages to write .NET applications.

The distinction between a langauge and runtime and library is more strict in .NET/C# than for example in C++, where the language specification also includes some basic library functions. The C# specification says only a very little about the environment (basically, that it should contain some types such asi int, but that's more or less all).

Tomas Petricek
thanks for well explaination. I shouldn't conclude that C# is a .Net because I code C++ too, although I never use .net library for C++, but it's there for use.
Bopha