您好,欢迎访问三七文档
当前位置:首页 > 建筑/环境 > 电气安装工程 > c#外文文献以及翻译
WhereC#FitsInInonesense,C#canbeseenasbeingthesamethingtoprogramminglanguagesas.NETistotheWindowsenvironment.JustasMicrosofthasbeenaddingmoreandmorefeaturestoWindowsandtheWindowsAPIoverthepastdecade,VisualBasicandC++haveundergoneexpansion.AlthoughVisualBasicandC++haveendedupashugelypowerfullanguagesasaresultofthis,bothlanguagesalsosufferfromproblemsduetothelegaciesofhowtheyhaveevolved.InthecaseofVisualBasic6andearlier,themainstrengthofthelanguagewasthefactthatitwassimpletounderstandanddidn’tmakemanyprogrammingtaskseasy,largelyhidingthedetailsoftheWindowsAPIandtheCOMcomponentinfrastructurefromthedeveloper.ThedownsidetothiswasthatVisualBasicwasnevertrulyobject-oriented,sothatlargeapplicationsquicklybecomedisorganizedandhardtomaintain.Aswellasthis,becauseVisualBasic’ssyntaxwasinheritedfromearlyversionsofBASIC(which,inturn,wasdesignedtobeintuitivelysimpleforbeginningprogrammerstounderstand,ratherthantowritelargecommercialapplications),itdidn’treallylenditselftowell-structuredorobject-orientedprograms.C++,ontheotherhand,hasitsrootsintheANSIC++languagedefinition.Itisn’tcompletelyANSIcompliantforthesimplereasonthatMicrosoftfirstwroteitsC++compilerbeforetheANSIdefinitionhadbecomeofficial,butitcomesclose.Unfortunately,thishasledtotwoproblems.First,ANSIC++hasitsrootsinadecade-oldstateoftechnology,andthisshowsupinalackofsupportformodernconcepts(suchasUnicodestringsandgeneratingXMLdocumentation),andinsomearchaicsyntaxstructuresdesignedforthecompilersofyesteryear(suchastheseparationofdeclarationfromdefinitionofmemberfunctions).Second,MicrosofthasbeensimultaneouslytryingtoevolveC++intoalanguagethatisdesignedforhigh-performancetasksonWindows,andinordertoachievethatthey’vebeenforcedtoaddahugenumberofMicrosoft-specifickeywordsaswellasvariouslibrariestothelanguage.TheresultisthatonWindows,thelanguagehasbecomeacompletemess.JustaskC++developershowmanydefinitionsforastringtheycanthinkof:char*,LPTSTR,string,CString(MFCversion),CString(WTLversion),wchar_t*,OLECHAR*,andsoon.Nowenter.NET—acompletelynewenvironmentthatisgoingtoinvolvenewextensionstobothlanguages.MicrosofthasgottenaroundthisbyaddingyetmoreMicrosoft-specifickeywordstoC++,andbycompletelyrevampingVisualBasicintoVisualBasic.NET,alanguagethatretainssomeofthebasicVBsyntaxbutthatissodifferentindesignthatwecanconsiderittobe,forallpracticalpurposes,anewlanguage.It’sinthiscontextthatMicrosofthasdecidedtogivedevelopersanalternative—alanguagedesignedspecificallyfor.NET,anddesignedwithacleanslate.VisualC#.NETistheresult.Officially,MicrosoftdescribesC#asa“simple,modern,object-oriented,andtype-safeprogramminglanguagederivedfromCandC++.”Mostindependentobserverswouldprobablychangethatto“derivedfromC,C++,andJava.”Suchdescriptionsaretechnicallyaccuratebutdolittletoconveythebeautyoreleganceofthelanguage.Syntactically,C#isverysimilartobothC++andJava,tosuchanextentthatmanykeywordsarethesame,andC#alsosharesthesameblockstructurewithbraces({})tomarkblocksofcode,andsemicolonstoseparatestatements.ThefirstimpressionofapieceofC#codeisthatitlooksquitelikeC++orJavacode.Behindthatinitialsimilarity,however,C#isaloteasiertolearnthanC++,andofcomparabledifficultytoJava.Itsdesignismoreintunewithmoderndevelopertoolsthanbothofthoseotherlanguages,andithasbeendesignedtogiveus,simultaneously,theeaseofuseofVisualBasic,andthehighperformance,low-levelmemoryaccessofC++ifrequired.SomeofthefeaturesofC#are:❑Fullsupportforclassesandobject-orientedprogramming,includingbothinterfaceandimplementationinheritance,virtualfunctions,andoperatoroverloading.❑Aconsistentandwell-definedsetofbasictypes.❑Built-insupportforautomaticgenerationofXMLdocumentation.❑Automaticcleanupofdynamicallyallocatedmemory.❑Thefacilitytomarkclassesormethodswithuser-definedattributes.Thiscanbeusefulfordocumentationandcanhavesomeeffectsoncompilation(forexample,markingmethodstobecompiledonlyindebugbuilds).❑Fullaccesstothe.NETbaseclasslibrary,aswellaseasyaccesstotheWindowsAPI(ifyoureallyneedit,whichwon’tbeallthatoften).❑Pointersanddirectmemoryaccessareavailableifrequired,butthelanguagehasbeendesignedinsuchawaythatyoucanworkwithouttheminalmostallcases.❑SupportforpropertiesandeventsinthestyleofVisualBasic.❑Justbychangingthecompileroptions,youcancompileeithertoanexecutableortoalibraryof.NETcomponentsthatcanbecalledupbyothercodeinthesamewayasActiveXcontrols(COMcomponents).❑C#canbeusedtowriteASP.NETdynamicWebpagesandXMLWebservices.Mostoftheabovestatements,itshouldbepointedout,doalsoapplytoVisualBasic.NETandManagedC++.ThefactthatC#isdesignedfromthestarttoworkwith.NET,however,meansthatitssupportforthefeaturesof.NETisbothmorecomplete,andofferedwithinthecontextofamoresuitablesyntaxthanforthoseotherlanguages.WhiletheC#languageitselfisverysimilartoJava,therearesomeimprovements:inparticular,Javaisnotdesignedtoworkwiththe.NETenvironment.Beforeweleavethesubject,weshouldpointoutacoupleoflimitationsofC#.Theoneareathelanguageisnotdesignedforistime-criticalorextremelyhighperformancecode—thekindwhereyoureallyareworriedaboutwhetheralooptakes1,000or1,050machinecyclestorunthr
本文标题:c#外文文献以及翻译
链接地址:https://www.777doc.com/doc-4838137 .html