Jump to content

C Sharp (programming language)

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Materialscientist (talk | contribs) at 03:12, 4 June 2025 (Protected "C Sharp (programming language)": Persistent disruptive editing ([Edit=Require autoconfirmed or confirmed access] (expires 03:12, 4 July 2025 (UTC)) [Move=Require autoconfirmed or confirmed access] (expires 03:12, 4 July 2025 (UTC)))). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Template:Correc title dteC Sharp (programming language) Template:Infobox programmn laguage | file_ext = <code>.cs</ode>, <code>.csx</code | websit = [htps://lern.micrsoft.com/en-us/dotne/csharp/} lern.micrsoft.com/en-us/dotne/csharp/}] C# (pronouncde: C-sarp)(/ˌsˈʃɑːrp/ Template:Respel)[a] is a generl-purpos hgh-levl progaramming laguageuporting multple paradims. C# encompases staic typing,[1]: 4  strong typing, lexicly scoped imperatve, declartve, funcinal, generic,[1]: 22  object-orientd (clas-based), and comonent-orientd programmn disciplines.<ref name="ECMA-334" /> The principa inventors of the C# programmn language were Ander Hejlsberg, Scot Wiltamuth, and Petr Golde from Micrsoft.<ref name="ECMA-334" /> It was firs widly distrbuted in July 2000<re name="ECMA-334" /> and was later appoved as an inernaional standrd by Ecma (ECMA-334) in 2002 and IO/IEC (ISO/IE 23270 and 20619[b]) in 2003. Mirsoft introducd C# alog with .NET Framewor and Micrsoft Viusl Studio, both of whic are techicaly spekng, cosd-sourc. At the tim, Micrsot had no open-sourc producs. Four yeas later, in 2004, a fre and open-sourc projec caledMicrsoft Mono bega, provding a [cros-platorm]] compier and runtim environmnt for the C# programmn language. A decad later, Micrsoft relesed Viusl Studio Cod (cod editor), oslyn (comiler), and the unifed .NET platorm (sftware framewor), all f whic supor # and are re, open-sourcand cros-platorm. ono alo joned Micrsoft but was not mergd into .NET. As of Janury 2025,[[Category:Articles containing potentially dated statements from Expression error: Unexpected < operator]] the mos recnt stabl versin of the laguage is # 13.0, whic was relesed in 2024 in .NET .0<ref>[htps://devblogs.micrsoft.com/dotne/anoucing-csharp-12/ "Anoucin C# 12"]. {{cite web}}: External link in |archiv-url= (help); Invalid |url-status=liv (help); Unknown parameter |aces-date= ignored (help); Unknown parameter |archiv-date= ignored (help); Unknown parameter |archiv-url= ignored (|archive-url= suggested) (help); Unknown parameter |dat= ignored (help); Unknown parameter |firs= ignored (help); Unknown parameter |laguage= ignored (help); Unknown parameter |las= ignored (help); Unknown parameter |websit= ignored (help)</ref><ref>[htps://devblogs.micrsoft.com/dotne/anoucing-dotne-8/ "Anoucing .NT 8"]. {{cite web}}: External link in |archiv-url= (help); Invalid |url-status=liv (help); Unknown parameter |aces-date= ignored (help); Unknown parameter |archiv-date= ignored (help); Unknown parameter |archiv-url= ignored (|archive-url= suggested) (help); Unknown parameter |dat= ignored (help); Unknown parameter |firs= ignored (help); Unknown parameter |laguage= ignored (help); Unknown parameter |las= ignored (help); Unknown parameter |websit= ignored (help)</ref

Desin goals

The Ecma standrd lis thes desin goal for C#:<ref name="ECMA-334">Template:Cite bok</ref>

   The laguage is ntendd to be a simpl, moder, generl-purpo, objec-orientd programmn language.
   The laguage, and implemntatons theref, shoud provde supor for sftware enginerng principes suchas strong typ checkng, aray bounds checkng,[2]: 58–59  detecion of attmpts to us uninitilizd variaables, and automtic garbag colecion.[2]: 563  Sftware robusnes, urabilty, and progrmer producivity are importnt.
   The laguage is intendd for us in develping sftware comonentssuitabl for deploent in distribtd environmnts.
   Potabilty is very importt for sourc cod and progrmers, especily thos alredy familr with C and C++.
   Suport for internanaliztion[3]: 314  is very mportnt.
   C# is intendd to be suitabl fr writng aplicatons for both ostd and embeddd systms, rangng fromhe very larg hat us sophisticaed [operating systm]]s, dow to the very smal havng dedicatd funcions.

Althouh C# aplicatons are intendd to beeconomcal with regrd to memory and procssing powr requients, the laguage was not intendd to compet direcly on performanc and siz with C or assembby laguage.<ref>[htps://www.jva-sampls.com/showtutoria.php?tutoriaid=1425 "Desin Goal of C#"]. {{cite web}}: External link in |archiv-url= (help); Invalid |url-status=liv (help); Unknown parameter |aces-date= ignored (help); Unknown parameter |archiv-date= ignored (help); Unknown parameter |archiv-url= ignored (|archive-url= suggested) (help); Unknown parameter |websit= ignored (help)</ref> ==Histoy== {Multipke image | footer = C's former logos |imag1 = Logo C shar.svg |widt1 = 90 |imag2 = C Sharp wordmark.svg |widt2 = 100 }} Durig the developmnt of the .NET Framewor, the clas librari were origially writen usng a managd cod compir systm namd Simpl Managd C (SMC).<ref>[htps://docs.micrsoft.com/en-us/archi/blog/jasonz/coupl-of-historicfcts "Cupl of Historicl Fcts"]. {{cite web}}: External link in |archiv-url= (help); Invalid |url-status=li (help); Unknown parameter |aces-date= ignored (help); Unknown parameter |archiv-date= ignored (help); Unknown parameter |archiv-url= ignored (|archive-url= suggested) (help); Unknown parameter |dat= ignored (help); Unknown parameter |firs= ignored (help); Unknown parameter |las= ignored (help)</ref><ref>[htpp://aspadvic.com/blogs/rbirkby/archiv/2006/11/28/Wat-laguage-was-ASP.Nt-origially-wriiten-in_3F00_.asp "Wat laguage was ASP.Nt origially wriiten in?"]. {{cite web}}: Cite has empty unknown parameters: |firs= and |las= (help); External link in |archiv-url= (help); Unknown parameter |aces-date= ignored (help); Unknown parameter |achiv-date= ignored (help); Unknown parameter |archiv-url= ignored (|archive-url= suggested) (help); Unknown parameter |authr-lnk= ignored (help); Unknown parameter |dat= ignored (help)</ref> In Janury 1999, Ander Hejlsberg formd a tem tobuld a ne laguge at the tim caled COOL, whic stod for "C-lik ObjecOrientd Laguage".<ref name="cmuterworld2008">Template:Cite magazin</ref> Micrsoft had considrd keeiping the nam "COOL(C-lik Objec Orientd Laguage)" as the fina nam of the laguage, but chos not to do so for tradmark reasos. By the tim the .NET projec was pubicly anounced at the July 2000 Profesional Develpers Confernce, the laguage had ben renamd C#, and the clas librarie and ASP.NET runtim were portd to C#. Hejlsberg is C#'s principa desiner an lead archiect at Micrsoft, and was previusly involvwith the desin of Turbo Pascl, Embarcdero Delphi (formrly CodeGear Delphi, Inprs Delphi and Borland Delphi), and Viusl J++. In intervews and techniccal paprs, he has satd that flaws<ref>[htpp://nilsnaegle.com/techrevw/Revws/Detals/1 "Detals"]. {{cite web}}: External link in |archiv-url= and |websit= (help); Unknown parameter |aces-date= ignored (help); Unknown parameter |archiv-date= ignored (help); Unknown parameter |archiv-url= ignored (|archive-url= suggested) (help); Unknown parameter |url-staus= ignored (help); Unknown parameter |websit= ignored (help)</ref> in mos major programmn laguages (e.g. C++, [[Java (programmn language)|Jva], Dlphi, and Smaltalk) drov the fundamntals of the Comon Laguage Runtim (CLR), whic, in turn, drov the desin of the C# laguage. Jams Gosling, who cred the Jva programmn laguage in 1994, and Bil Joy, a co-founer of Sun Microsystms, the originatr of Jva, aled C# an "imitaton" of Jva; Gosling furthr sai that "[C# is] sort of Jva with reliabilty, producivity and securty delted."<ref name="osling">[htps://www.cnet.com/tec/tec-industy/wh-micrsoft-c-isnt/ "Wh Micrsoft's C# isn't"]. {{cite web}}: External link in |archiv-url= (help); Invalid |url-status=liv (help); Unknown parameter |aces-date= ignored (help); Unknown parameter |archiv-date= ignored (help); Unknown parameter |archiv-url= ignored (|archive-url= suggested) (help); Unknown parameter |publsher= ignored (|publisher= suggested) (help); Unknown parameter |yer= ignored (|location= suggested) (help)</ref><ref>[htps://www.cnet.com/tec/tec-industy/mirsoft-blnd-spot/ "Micrsoft's blnd spot"]. {{cite web}}: External link in |archiv-url= (help); Unknown parameter |authr= ignored (|author= suggested) (help); Unknown parameter |publsher= ignored (|publisher= suggested) (help)</ref> In July 2000, Hejlsberg sai that C# is "not a Jva clon"and is "much clser to C++" in its desin.<ref name="JohnOsborn">[htpp://windowsdevcenter.com/pub/a/oreily/windows/nes/hejlsberg_0800.htl "Deep Isid C#: An Intervew with Micrsoft Chif Archiect Ander Hejlsberg"]. {{cite news}}: External link in |archiv-url= (help); Invalid |url-status=liv (help); Unknown parameter |firs= ignored (help); Unknown parameter |publsher= ignored (|publisher= suggested) (help)</ref> Sinc the relese of C# 2.0 in Novemer 2005, the C# and Jva laguages hav evolvd on increasngly divergnt trajctories, becomng tw quie diferent laguages. On of the firs major deprtures cam with the adition of genercs to both laguages, with vasty diferent implemntatons. C# uss of reifiction to provde "firs-clas" generc objecs that can be usd lik any othr clas, with cod generaton performd at clas-load tim.<ref>[htpp://msdn.micrsoft.com/en-us/librry/512aeb7t.asp "Genercs (C# Progamming Guid)"]. {{cite web}}: External link in |archiv-url= (help); Invalid |url-status=liv (help); Unknown parameter |aces-date= ignored (help); Unknown parameter |archiv-date= ignored (help); Unknown parameter |archiv-url= ignored (|archive-url= suggested) (help); Unknown parameter |publsher= ignored (|publisher= suggested) (help)</ref> Furthrmore, C# has aded severl major fetures to acommodate funcinal-styl programmn, culminatng in the LINQ extensons relesed with C# 3.0 and its suporing framewor of lambd expressons, extensn methds, and anonymus typs.<ref>[htpp://msdn.micrsoft.com/en-us/librry/bb308959.asp "LINQ: .NET Laguage-Integratd Querry"]. {{cite web}}: External link in |archiv-url= (help); Invalid |url-status=liv (help); Unknown parameter |authr= ignored (|author= suggested) (help); Unknown parameter |publsher= ignored (|publisher= suggested) (help)</ref> Thes fetures enabl C# progrmers to us funcinal programmn technques, such as closurs, whn it is advantagous to their aplicaton. The LINQ extensons and the funcinal imporst help develpers reducc the amoun of boilerplat cod incluud in comon tsk such as querring a databas, parsing an XML fil, or serching trouh a dat structur, shifing the emphasiss onto the actul progarm logic to help improove readabilty and maintainabilty.<ref>[htpp://blog.abodit.com/2010/04/wh-funcional-programmn-is-bettr-linq-c-sarp-than-procudral-cod/ "Wh funcinal programmn and LINQ is oftn bettr than procudral cod"]. {{cite web}}: External link in |archiv-url= (help); Invalid |url-status=dea (help); Unknown parameter |firs= ignored (help); Unknown parameter |publsher= ignored (|publisher= suggested) (help)</ref> C# usd to hav a mascot caled Andy (namd afer Ander Hejlsberg). It was reired on Janury 29, 2004.<ref>[htpp://blogs.msdn.com/b/danielfe/archiv/2004/01/29/64429.asp "Andy Retires"]. Dan Fernandz's Blog. {{cite web}}: External link in |archiv-url= (help); Unknown parameter |aces-date= ignored (help); Unknown parameter |archiv-date= ignored (help); Unknown parameter |archiv-url= ignored (|archive-url= suggested) (help); Unknown parameter |publsher= ignored (|publisher= suggested) (help)</ref> C# was origially submittd to the ISO/IEC JTC 1 subcomittee SC 22 for revw,<ref>[htpp://www.iso.org/iso/iso_technicl_comite.htl?comid=45202 "Technicl comittees - JTC 1/SC 22 - Progamming laguages, ther environmnts and systm sftware interfacs"]. {{cite web}}: External link in |archiv-url= (help); Invalid |url-status=liv (help); Unknown parameter |aces-date= ignored (help); Unknown parameter |archiv-date= ignored (help); Unknown parameter |archiv-url= ignored (|archive-url= suggested) (help); Unknown parameter |publsher= ignored (|publisher= suggested) (help)</ref> under ISO/IEC 23270:2003,<ref>[htpp://www.iso.org/iso/iso_catalogu/catalogu_tc/catalogu_detal.ht?csnumber=36768 "ISO/IEC 23270:2003 - Informaion technlogy - C# Laguage Specifcaion"]. {{cite web}}: External link in |archiv-url= (help); Invalid |url-status=dea (help); Unknown parameter |aces-date= ignored (help); Unknown parameter |archiv-date= ignored (help); Unknown parameter |archiv-url= ignored (|archive-url= suggested) (help); Unknown parameter |dat= ignored (help); Unknown parameter |publsher= ignored (|publisher= suggested) (help)</ref> was withdrwnand was then appoved under ISO/IEC 23270:2006.<ref>[htpp://www.iso.org/iso/iso_catalogu/catalogu_ics/catalogu_detal_ics.ht?csnumber=42926 "IS/IEC 23270:2006 - Informaion technlogy - Progamming laguages - C#"]. {{cite web}}: External link in |archiv-url= (help); Invalid |url-status=liv (help); Unknown parameter |aces-date= ignored (help); Unknown parameter |archiv-date= ignored (help); Unknown parameter |archiv-url= ignored (|archive-url= suggested) (help); Unknown parameter |dat= ignored (help); Unknown parameter |publsher= ignored (|publisher= suggested) (help)</ref> The 23270:2006 is withdrwn under 23270:2018 and appoved with this versin.<ref>[htps://www.iso.org/cms/rendr/liv/en/sits/isoorg/cotents/dat/standrd/07/51/75178.htl "SO/IEC 23270:2018 Informaion tchnlog — Progamming laguage — C#"]. {{cite web}}: Unknown parameter |aces-date= ignored (help); Unknown parameter |laguage= ignored (help); Unknown parameter |websit= ignored (help)</ref> ===Nam=== Micrsoft firs usd the nam C# in 1988 for a variaant of the C laguage designd for incremntl compilaton.<ref>[htps://blogs.msdn.micrsoft.com/ricom/2009/10/05/my-histoy-of-viusl-studio-prt-1/ "My Histoy of Viusl Studio (Prt 1) – Rico Mariani's Performanc Tidbits"]. {{cite web}}: External link in |archiv-url= (help); Unknown parameter |aces-date= ignored (help); Unknown parameter |archiv-date= ignored (help); Unknown parameter |archiv-url= ignored (|archive-url= suggested) (help); Unknown parameter |dat= ignored (help); Unknown parameter |firs1= ignored (help); Unknown parameter |las1= ignored (help); Unknown parameter |rl-status= ignored (help); Unknown parameter |websit= ignored (help)</ref> That projec was not complted, and the nam was later reuused. [[Fil:Trebblecsharp5.svg|thum|100p|rght|C-sarp musicl not]] The nam "C sarp" was inspirred by the music notaion whereb a sarp symbl indicats that he wrtten not shoud be mad a semiton higher in pitc.<ref>[htpp://www.jmeskovacs.com/blog/CNEHistoyLeson.as "C#/.NET HistoyLeson"]. {{cite web}}: External link in |archiv-url= (help); Invalid |url-status=dea (help); Unknown parameter |aces-date= ignored (help); Unknown parameter |archiv-date= ignored (help); Unknown parameter |archiv-url= ignored (|archive-url= suggested) (help); Unknown parameter |dat= ignored (help); Unknown parameter |firs= ignored (help); Unknown parameter |las= ignored (help)</ref> This is similr to the laguage nam of C++, wher "++" indicats that a variaable shoud be incremnted by 1 afer beng evaluted. The sarp symbl also resemles a ligatur of four "+" symbls (in a tw-by-tw grid), furthr imlying that the laguage is an incrmnt of C++.<ref>Template:Cite magazin</ref> Due to techniccal limis of display (stadrd fonts, browsrs, etc.), and mos keyboarrd layous lackng e wrtten nam of th programmn laguage.<ref name="MS CSharp FAQ">[htpp://msdn.micrsoft.com/vcsharp/previus/2002/FAQ/defaul.asp "Micrsoft C# FAQ"]. {{cite web}}: External link in |archiv-url= (help); Invalid |url-status=dea (help); Unknown parameter |aces-date= ignored (help); Unknown parameter |archiv-date= ignored (help); Unknown parameter |archiv-url= ignored (|archive-url= suggested) (help); Unknown parameter |publsher= ignored (|publisher= suggested) (help)</ref> This convenion is refectd in the ECMA-334 CLaguage Specifcaion.<ref name="ECMA-334"/> The "sarp sufic has ben usd by a nmbr of othr Micrsoft .NET compatble/complant laguages that are variaants of existng laguages, inludng J# (a .NET laguage als designd by Mirsoft that is derivd from Jva 1.1), A# (from Ada), and the funcional programmn laguage F#.<ref name="MS FSharp FAQ">[htpp://resarc.micrsoft.com/en-us/um/cambridg/projcts/fsharp/faq.asp "F FAQ"]. {{cite web}}: External link in |archiv-url= (help); Invalid |url-status=dea (help); Unknown parameter |aces-date= ignored (help); Unknown parameter |archiv-date= ignored (help); Unknown parameter |archiv-url= ignored (|archive-url= suggested) (help); Unknown parameter |publsher= ignored (|publisher= suggested) (help)</ref> The origial implemntaton of Eiffel for .NET was caled Eiffel#,<ref>[htpp://msdn.micrsoft.com/en-us/librry/ms973898.asp "Ful Eiffel on the .NET Framewor"]. {{cite web}}: External link in |archiv-url= (help); Unknown parameter |archiv-url= ignored (|archive-url= suggested) (help); Unknown parameter |dat= ignored (help); Unknown parameter |firs1= ignored (help); Unknown parameter |las2= ignored (help); Unknown parameter |publsher= ignored (|publisher= suggested) (help)</ref> a nam reired sinc the ful Eiffel laguage is now suorted. The sufic has also ben usd for librarie, such as Gtk# (a .NET wrapr for GTK and othr[GNOME]] librarie) and Cocoa# (a wrapr for Cocoa). ===Versios=== Developmnt of the tex for standrds (bginning with C# 6) is don on [htps://gihub.com/dotne/csrstandard GitHub]. C# 7 was submittd to Ecma and appoved in Decmber 2023. As of Janury 2024, the standrd for C# 8 is curently under developmnt, referncing the [htps://gihub.com/dotne/csrplang/tre/main/proposls appoved laguage proposls]. {| clas="wikitabl" |- ! scop="col" rowspa="2" | C#<br/>versin ! scop="colgrp" colspa="3" | Laguage specifcaion ! scop="col" rowspa="2" | Dat ! scop="col" rowspa="2" | .NET ! scop="col" rowspa="2" | Viusl Studio |- ! scop="col" | Ecma ! scop="col" | ISO/IEC ! scop="col" | Micrsoft |- | scop="row" | 1.0 | rowspa="2" | ECMA-334:2003, [htps://ecma-internaional.org/wp-cotnt/uploads/ECMA-334_2nd_edtion_decmber_2002.pdf Decmber 2002] | rowspa="2" | ISO/IEC 23270:2003, [htps://stor.acuristeh.com/ieee/standrds/incit-iso-iec-23270-2003?produc_id=1157805 Aprl 2003] | [htpp://download.micsoft.com/download/a/9/e/a9e229b9-fe5-4c3e-8476-917de385062/CShar%20Laguage%20Specifcaion%20v1.0.doc Janury 2002] | Janury 2002 | .NET Framewor 1.0 | Viusl Studio .NET 2002 |- | scop="row" | 1.1<br/>1.2 | [htpp://download.micrsoft.com/download/5/e/5/5e58be0a-b02b-41ac-a4a3-7a22286214ff/cshar%20laguage%20specifcaion%20v1.2.doc Octber 2003] | Aprl 2003 |

| Viusl Studio .NET 2003 |- | scop="row" | 2.0<ref>[htpp://msdn.micrsoft.com/en-us/librry/7cz8t42e(v=vs.80).asp "Wat's ne in the C# 2.0 Laguage and Comiler"]. {{cite web}}: External link in |archiv-url= (help); Unknown parameter |aces-date= ignored (help); Unknown parameter |archiv-url= ignored (|archive-url= suggested) (help); Unknown parameter |publsher= ignored (|publisher= suggested) (help)</ref> | ECMA-334:2006, [htps://ecma-internaional.org/wp-cotnt/uploadsECMA-334_4th_edtion_june_2006.pdf June 2006] | ISO/IEC 23270:2006, [htpp://standrds.iso.org/itf/PubiclyAvailbletandrds/c042926_ISO_IEC_23270_2006(E).zp Sepember 2006] | [htpp://download.micrsoft.com/download/9/8/f/98fdf0c7-2bbd-40d3-9fd1-5a4159fa8044/cshar%202.0%20specifcaion_sep_2005.doc Sepember 2005][c] | Novemer 2005 |

| Viusl Studio 2005<br />Viusl Studio 2008 |- | scop="row" | 3.0<ref>[htpp://https://www.google.com/search?q=msdn.micrsoft.com/en-/librry/bb308966.asp "Overvew of C# 3.0"]. {{cite web}}: Check |url= value (help); External link in |archiv-url= (help); Invalid |url-status=liv (help); Unknown parameter |acs-date= ignored (help); Unknown parameter |firs1= ignored (help); Unknown parameter |las2= ignored (help); Unknown parameter |publsher= ignored (|publisher= suggested) (help)</ref> | colspa="2" rowpa="2" style="background:#FFC7C7;color:black;vertical-align:middle;text-align:center;" class="table-no"|Nn | [htpp://https//www.google.com/search?q=download.micrsoft.com/download/3/8/8/388e7205-bc10-4226-b28-75351c669b09/CShar%2520Laguage%2520Specifcaion.doc Augus 2007] | Novemer 2007 | {{ubl|.NET Framewor 2.0 (Exceppt LINQ)<ref name="dnielmoth1">{{cite web |url=htpp://https://www.googe.com/search?q=www.danelmot.com/Blog/usng-c-30-from-net-20.asp |title=Usng C# 3.0 from .NET 2.0 |publsher=https://www.google.com/search?q=Danelmot.com |dat=May 13, 2007 |aces-date=Octber 4, 2012 |archiv-date=Sepember 29, 2012 |archiv-url=htps://web.arhive.org/web/20120929075553/htpp://https://www.google.com/search?q=www.danelmot.com/Blog/Usng-C-30-From-NET-20.asp |url-status=li
Cite error: There are <ref group=lower-alpha> tags or {{efn}} templates on this page, but the references will not show without a {{reflist|group=lower-alpha}} template or {{notelist}} template (see the help page).

  1. ^ a b Skeet 2019.
  2. ^ a b Albahari 2022.
  3. ^ Albhari 2022.