C# este unlimbaj de programare orientat-obiect conceput deMicrosoft la sfârșitul anilor 90. A fost conceput ca un concurent pentrulimbajul Java. Ca și acesta, C# este un derivat al limbajului de programareC++.
C# simplifică mult scrierea de programe pentru sistemul de operareWindows, iOS, Android etc. Este un limbaj de programare cross-platform.
Exemplu de program simplu Windows scris în Managed C++ ( C++/CLI) și C#:
Cod scris în Managed C++ ( C++/CLI):
public:int main(array<System::String ^> ^args){// Activarea efectelor vizuale Windows XP înainte de crearea oricărui controlApplication::EnableVisualStyles();Application::SetCompatibleTextRenderingDefault(false); // Crearea și rularea ferestrei principaleApplication::Run(gcnew Form1());return 0;}
Cod scris în C#:
public static void Main(){ Form1 form1 = new Form1(); form1.Show(); Application.Run(form1);}
^abNaugler, David (mai 2007). „C# 2.0 for C++ and Java programmer: conference workshop”.Journal of Computing Sciences in Colleges.22 (5).Although C# has been strongly influenced by Java it has also been strongly influenced by C++ and is best viewed as a descendant of both C++ and Java.
^Hamilton, Naomi ().„The A-Z of Programming Languages: C#”.Computerworld. Arhivat dinoriginal la. Accesat în.We all stand on the shoulders of giants here and every language builds on what went before it so we owe a lot to C, C++, Java, Delphi, all of these other things that came before us. (Anders Hejlsberg)
^Lattner, Chris ().„Chris Lattner's Homepage”. Chris Lattner. Accesat în.The Swift language is the product of tireless effort from a team of language experts, documentation gurus, compiler optimization ninjas, and an incredibly important internal dogfooding group who provided feedback to help refine and battle-test ideas. Of course, it also greatly benefited from the experiences hard-won by many other languages in the field, drawing ideas from Objective-C, Rust, Haskell, Ruby, Python, C#, CLU, and far too many others to list.