C-sharp
- The correct title of this article is C#. The title appears differently due to technical limitations.
C# | |
---|---|
Appeared in | 2000 |
Designed by | Microsoft |
C# (or C-Sharp) is a compiled, multi-paradigm programming language developed by Microsoft, which first appeared in 2000.
C# was influenced by languages like C++ and Java, and aims to be a modern object-oriented programming language. The latest release of C# was 5.0, released August 15, 2012. It is part of Microsoft's .NET Framework, and thus requires the end-user to have the .NET Framework runtimes installed in order to run applications created with it.
Examples
A simple "Hello, World!" application in C#, using a console application.
<csharp>using System;
namespace Test {
class HelloWorld {
public static void Main(string[] args) {
Console.WriteLine ("Hello, World!"); } } }</csharp>
Outputs:
Hello, World!
We can also get user input, and use it accordingly.
<csharp>using System;
namespace Test {
class SayHi {
public static void Main(string[] args) {
string name;
Console.Write ("What is your name?: ");
name = Console.ReadLine ();
Console.WriteLine ("Hello there, {0}!", name); } } }</csharp>
This outputs: (Having entered out name as Justin)
What is your name?: Justin
Hello there, Justin!