Coder Perfect

What are the distinctions between C# and.NET?

Problem

What is the difference between C# and.NET, please? When I think of C#, I immediately think of.NET, yet when I look for job openings, they always demand candidates to have C# and.NET experience. Could someone please explain this to me?

Asked by Bopha

Solution #1

C# is a programming language, and.NET refers to both the.NET Framework (an application framework library) and the Common Language Runtime (the runtime in which.NET assemblies are executed).

Because the.NET Framework and Microsoft’s implementation of C# are so closely linked, it’s easy to get the two concepts mixed up. However, it is critical to recognise the distinction between the two.

Here’s an example of a C# class:

class Example { }

Here’s a C# class that uses a.NET framework assembly, type, and method explicitly:

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 previously stated, using Microsoft’s implementation of C# without the.NET framework is quite tough. 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 phrase “Microsoft’s implementation of C#” is used because there are other C# implementations available.

Answered by Andrew Hare

Solution #2

It’s worth noting, in addition to Andrew’s response, that:

In.NET/C#, the difference between a language, a runtime, and a library is clearer than in C++, where the language definition includes certain basic library functions. The C# standard only mentions a few things about the environment (essentially, that it should have some types like int, but that’s about it).

Answered by Tomas Petricek

Solution #3

C# is a programming language, and.NET is the framework on which it is based.

Answered by heisenberg

Solution #4

C# is a powerful Object-Oriented programming language based on the Microsoft.NET framework.

The plane is C#, and the runway is.NET.

Answered by Fareevar

Solution #5

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’re familiar with Java, you’ll recognize this… Although Java is a language created on top of the JVM, any of the pre-assembled Java libraries can be utilized by another JVM-based language.

Answered by Polaris878

Post is based on https://stackoverflow.com/questions/2724864/what-is-the-difference-between-c-sharp-and-net