Jump to content

C Sharp (programming language)

From Simple English Wikipedia, the free encyclopedia
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
The title of this article is wrong due to some technical limitations. The right title is C# (programming language).
C#
Designed byMicrosoft
DeveloperMicrosoft
First appeared2000; 25 years ago (2000)
Stable release13.0[1] Edit this on Wikidata / 12 November 2024; 4 months ago (12 November 2024)
Filename extensions.cs
Websitedocs.microsoft.com/en-us/dotnet/csharp/,%20https://docs.microsoft.com/de-de/dotnet/csharp/,%20https://docs.microsoft.com/ja-jp/dotnet/csharp/,%20https://docs.microsoft.com/fr-fr/dotnet/csharp/,%20https://docs.microsoft.com/it-it/dotnet/csharp/

C# (pronounced "see sharp") is a computer programming language. It is developed by Microsoft. It was created to use all capacities of the .NET platform. The first version was released in 2001. C# is a modern language in active development, with the most recent version at time of writing being C# 13, which was released in June 2024 alongside .NET 9.[2] C#'s development team is led by Anders Hejlsberg, the creator of Delphi.

Execution Platform

Today, C# can be run on most platforms (Windows, Linux, macOS, etc.) without changing the source code. C# can be run on the Xbox 360 platform with a special framework.

Syntax

C# code is similar to C++ and Java code. The CLR (Common Language Runtime) is needed in order to run a C# program.[3]

"Hello, World!" example

/* This is a simple program in C#. 
 * It simply shows "Hello, World!" on the screen.
 */
using System;
namespace HelloWorld
{
  class Hello
  {
    static void Main()
    {
      Console.WriteLine("Hello, World!");
      
      // The piece of code below is optional, but is needed to prevent the program from closing immediately.
      
      Console.WriteLine("Press any key to exit.");
      Console.ReadKey();
    }
  } 
}

Basic input example

/* 
 * This program asks for input from the user, i.e. a name. It then prints "Hello [name]", replacing [name] with whatever the person typed in.
 */
using System;
namespace HelloWorld
{
  class Hello
  {
    static void Main()
    {
      Console.WriteLine("Hello, please type in your name:");
      string name = Console.ReadLine();
      Console.WriteLine("Hello {0}",name);
      Console.ReadKey();
    }
  } 
}

Integrated Development Environments

C# can be edited in a number of IDEs (Integrated Development Environments), some of which are listed below:

Windows:

Mac OS X:

Unix/Linux:

Sources

  1. Error: Unable to display the reference properly. See the documentation for details.
  2. BillWagner (2024-07-03). "What's new in C# 13". learn.microsoft.com. Retrieved 2024-07-26.
  3. Collected Computer Programming Problems in Visual C#.Net, Hary Gunarto. Tech Publication, Singapore. 2007. ISBN 978-9812141743.

Other websites