kids encyclopedia robot

C Sharp (programming language) facts for kids

Kids Encyclopedia Facts
Quick facts for kids
C#
Designed by Microsoft
Developer Microsoft
First appeared 2000; 25 years ago (2000)
Stable release
8.0 / September 23, 2019; 5 years ago (2019-09-23)
Filename extensions .cs

C# (pronounced "see sharp") is a computer programming language. It was made by Microsoft to work well with their .NET platform. The first version of C# came out in 2001. The newest version, C# 8.0, was released in September 2019. C# is a modern language that is always being updated. The main person leading the team that develops C# is Anders Hejlsberg.

What C# Runs On

C# programs can run on different computer systems. These include:

Today, C# can run on many systems like Windows and Linux. You usually don't need to change the code for it to work on different systems. C# can even run on the Xbox 360 game console if you use a special tool.

How C# Code Looks

C# code looks a lot like code from other languages such as C++ and Java. To make a C# program work, you need something called the CLR (Common Language Runtime). The CLR helps your computer understand and run the C# instructions.

"Hello, World!" Example

This is a very simple program that many programmers learn first. It just makes the computer show the words "Hello, World!" on the screen.

/* This is a simple program in C#.
 * It simply shows "Hello, World!" on the screen.
 */
using System; // This line lets us use basic system tools.
namespace HelloWorld // This creates a group for our program.
{
  class Hello // This is where our main program code goes.
  {
    static void Main() // This is the starting point of the program.
    {
      Console.WriteLine("Hello, World!"); // This line prints "Hello, World!"

      // The lines below are optional. They stop the program from closing right away.
      Console.WriteLine("Press any key to exit."); // Asks the user to press a key.
      Console.ReadKey(); // Waits for the user to press a key.
    }
  }
}

Basic Input Example

This program shows how a C# program can ask you for information. It will ask for your name and then say hello to you using the name you typed.

/* 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; // This line lets us use basic system tools.
namespace HelloWorld // This creates a group for our program.
{
  class Hello // This is where our main program code goes.
  {
    static void Main() // This is the starting point of the program.
    {
      Console.WriteLine("Hello, please type in your name:"); // Asks the user for their name.
      string name = Console.ReadLine(); // This line reads what the user types.
      Console.WriteLine("Hello {0}",name); // This line prints "Hello" and the name.
      Console.ReadKey(); // Waits for the user to press a key.
    }
  }
}

Tools for Writing C# Code

You can write C# code using special programs called IDEs (Integrated Development Environments). These tools make it easier to write, test, and fix your code. Here are some popular IDEs for C#:

Windows:

Mac OS X:

Unix/Linux:

Related pages

Images for kids

See also

In Spanish: C Sharp para niños

kids search engine
C Sharp (programming language) Facts for Kids. Kiddle Encyclopedia.