PUBLISHEDBY
MicrosoftPress
ADivisionofMicrosoftCorporation
OneMicrosoftWay
Redmond,Washington98052-6399
Copyright©2006byMicrosoftCorporation
Allrightsreserved.Nopartofthecontentsofthisbookmaybereproduced
ortransmittedinanyformorbyanymeanswithoutthewrittenpermission
ofthepublisher.
LibraryofCongressControlNumber2005933123
PrintedandboundintheUnitedStatesofAmerica
123456789QWT876543
DistributedinCanadabyH.B.FennandCompanyLtd.ACIPcatalogue
recordforthisbookisavailablefromtheBritishLibrary.
MicrosoftPressbooksareavailablethroughbooksellersanddistributors
worldwide.Forfurtherinformationaboutinternationaleditions,contactyour
localMicrosoftCorporationofficeorcontactMicrosoftPressInternational
directlyatfax(425)936-7329.VisitourWebsiteat
www.microsoft.com/learning/.Sendcommentsto
Microsoft,ActiveX,Excel,IntelliSense,JScript,MicrosoftPress,MSDN,
VisualBasic,VisualC#,VisualJ#,VisualStudio,Windows,andWindows
ServerareeitherregisteredtrademarksortrademarksofMicrosoft
CorporationintheUnitedStatesand/orothercountries.Otherproductand
companynamesmentionedhereinmaybethetrademarksoftheirrespective
owners.
Theexamplecompanies,organizations,products,domainnames,e-mail
addresses,logos,people,places,andeventsdepictedhereinarefictitious.No
associationwithanyrealcompany,organization,product,domainname,emailaddress,logo,person,place,oreventisintendedorshouldbeinferred.
Thisbookexpressestheauthor'sviewsandopinions.Theinformation
containedinthisbookisprovidedwithoutanyexpress,statutory,orimplied
warranties.Neithertheauthors,MicrosoftCorporation,noritsresellers,or
distributorswillbeheldliableforanydamagescausedorallegedtobe
causedeitherdirectlyorindirectlybythisbook.
AcquisitionsEditor:BenRyan
ProjectEditor:LynnFinnel
TechnicalEditors:SteveLambertandJonKenoyer
EditorialandProduction:OnlineTrainingSolutions,Inc.
BodyPartNo.X11-44955
CompanionContent
Thistitleincludesreferencestoelectroniccontent,suchassamplefiles,
samplecode,betasoftware,tools,andothercontent.Thiscontentis
providedasanadditionallearningtooltoaccompanythetext.Althoughthe
referencestothiscontentmightmentionaCDorCD-ROMwherethesefiles
areavailable,youcanaccessselectedportionsofthiscontentonlineby
goingto />ToviewthecompanioncontentforatitleatthisWebsite,typeinthe
productISBN(InternationalStandardBookNumber)ofthetitleinthetext
boxandclickGo.
TheISBNforthistitleislistedbelowandcanalsobefoundontheLOC
(LibraryofCongress)pagelistedintheTableofContents.
ISBN:0-7356-2129-2
Introduction
MicrosoftVisualC#isapowerfulbutsimplelanguageaimedprimarilyat
developerscreatingapplicationsbyusingtheMicrosoft.NETFramework.It
inheritsmanyofthebestfeaturesofC++andMicrosoftVisualBasic,butfew
oftheinconsistenciesandanachronisms,resultinginacleanerandmore
logicallanguage.TheadventofC#2.0hasseenseveralimportantnew
featuresaddedtothelanguage,includingGenerics,Iterators,andanonymous
methods.ThedevelopmentenvironmentprovidedbyMicrosoftVisualStudio
2005makesthesepowerfulfeatureseasytouse,andthemanynewwizards
andenhancementsincludedinVisualStudio2005cangreatlyimproveyour
productivityasadeveloper.
Theaimofthisbookistoteachyouthefundamentalsofprogrammingwith
C#byusingVisualStudio2005andthe.NETFramework.Youwilllearnthe
featuresoftheC#language,andthenusethemtobuildapplicationsrunning
ontheMicrosoftWindowsoperatingsystem.Bythetimeyoucompletethis
book,youwillhaveathoroughunderstandingofC#andwillhaveuseditto
buildWindowsFormsapplications,accessMicrosoftSQLServerdatabases,
developASP.NETWebapplications,andbuildandconsumeaWebservice.
FindingYourBestStartingPointinThisBook
Thisbookisdesignedtohelpyoubuildskillsinanumberofessentialareas.
Youcanusethisbookifyouarenewtoprogrammingorifyouareswitching
fromanotherprogramminglanguagesuchasC,C++,SunMicrosystems
Java,orVisualBasic.Usethefollowingtabletofindyourbeststartingpoint.
Ifyouare
Newto
objectoriented
programming
Followthesesteps
1. Installthepracticefilesasdescribedinthenext
section,“InstallingandUsingthePracticeFiles.”
2. WorkthroughthechaptersinPartsI,II,andIII
sequentially.
3. CompletePartsIV,V,andVIasyourlevelof
experienceandinterestdictates.
NewtoC#
1. Installthepracticefilesasdescribedinthenext
section,“InstallingandUsingthePracticeFiles.”
SkimthefirstfivechapterstogetanoverviewofC#
andVisualStudio2005,andthenconcentrateon
Chapters6through19.
2. CompletePartsIV,V,andVIasyourlevelof
experienceandinterestdictates.
Migrating
fromC,C++,
orJava
1. Installthepracticefilesasdescribedinthenext
section,“InstallingandUsingthePracticeFiles.”
2. SkimthefirstsevenchapterstogetanoverviewofC#
andVisualStudio2005,andthenconcentrateon
Chapters8through19.
3. ForinformationaboutbuildingWindowsapplications
andusingadatabase,readPartsIVandV.
4. ForinformationaboutbuildingWebapplicationsand
Webservices,readPartVI.
Switching
fromVisual
Basic6
1. Installthepracticefilesasdescribedinthenext
section,“InstallingandUsingthePracticeFiles.”
2. WorkthroughthechaptersinPartsI,II,andIII
sequentially.
3. ForinformationaboutbuildingWindowsapplications,
readPartIV.
4. Forinformationaboutaccessingadatabase,readPart
V.
5. ForinformationaboutcreatingWebapplicationsand
Webservices,readPartVI.
6. ReadtheQuickReferencesectionsattheendofthe
chaptersforinformationaboutspecificC#andVisual
Studio2005constructs.
Referencing
thebookafter
working
throughthe
exercises
1. UsetheindexortheTableofContentstofind
informationaboutparticularsubjects.
2. ReadtheQuickReferencesectionsattheendofeach
chaptertofindabriefreviewofthesyntaxand
techniquespresentedinthechapter.
ConventionsandFeaturesinThisBook
Thisbookpresentsinformationbyusingconventionsdesignedtomakethe
informationreadableandeasytofollow.Beforeyoustartthebook,readthe
followinglist,whichexplainsconventionsyou'llseethroughoutthebook
andpointsouthelpfulfeaturesinthebookthatyoumightwanttouse.
Conventions
Eachexerciseisaseriesoftasks.Eachtaskispresentedasaseriesof
numberedsteps(1,2,andsoon).Aroundbullet(•)indicatesan
exercisethathasonlyonestep.
Noteslabeled“tip”provideadditionalinformationoralternative
methodsforcompletingastepsuccessfully.
Noteslabeled“important”alertyoutoinformationyouneedtocheck
beforecontinuing.
Aplussign(+)betweentwokeynamesmeansthatyoumustpress
thosekeysatthesametime.Forexample,“PressAlt+Tab”meansthat
youholddowntheAltkeywhileyoupresstheTabkey.
OtherFeatures
Sidebarsthroughoutthebookprovidemorein-depthinformationabout
theexercise.Thesidebarsmightcontainbackgroundinformation,
designtips,orfeaturesrelatedtotheinformationbeingdiscussed.
EachchapterendswithaQuickReferencesection.TheQuick
Referencesectioncontainsquickremindersofhowtoperformthetasks
youlearnedinthechapter.
OnlineCompanionContent
Theonlinecompanioncontentpagehascontentandlinksrelatedtothis
book.
/>
TechnologyUpdates
Astechnologiesrelatedtothisbookareupdated,linkstoadditional
informationwillbeaddedtotheMicrosoftPressTechnologyUpdatesWeb
page.VisitthispageperiodicallyforupdatesonVisualStudio2005and
othertechnologies.
/>NOTE
PracticefilesforthisbookareonthecompanionCD.
SystemRequirements
You'llneedthefollowinghardwareandsoftwaretocompletetheexercisesin
thisbook:
MicrosoftWindowsXPProfessionalEditionwithServicePack2,
MicrosoftWindowsServer2003withServicePack1,orWindows
2000withServicePack4.(MicrosoftWindows2000DatacenterServer
isnotsupported.)
MicrosoftVisualStudio2005StandardorProfessionalEdition,
includingSQLServer2005Express.
766MHzPentiumorcompatibleprocessor(1.5GHzPentium
recommended).
256MBRAM(512MBormorerecommended).
Videomonitor(800×600orhigherresolution)withatleast256colors
(1024×768HighColor16-bitrecommended).
CD-ROMorDVD-ROMdrive.
MicrosoftMouseorcompatiblepointingdevice.
YouwillalsoneedtohaveAdministratoraccesstoyourcomputerto
configureSQLServer2005ExpressEditionandtomodifytheWindows
RegistryinChapter28,“CreatingandUsingaWebService.”
PrereleaseSoftware
ThisbookwasreviewedandtestedagainsttheAugust2005Community
TechnicalPreview(CTP)ofVisualStudio2005.TheAugustCTPwasthe
lastpreviewbeforethefinalreleaseofVisualStudio2005.Thisbookis
expectedtobefullycompatiblewiththefinalreleaseofVisualStudio2005.
Ifthereareanychangesorcorrectionsforthisbook,theywillbecollected
andaddedtoaMicrosoftKnowledgeBasearticle.Seethe“Supportforthis
Book”sectioninthisIntroductionformoreinformation.
InstallingandUsingthePracticeFiles
ThecompanionCDinsidethisbookcontainsthepracticefilesthatyou'lluse
asyouperformtheexercisesinthebook.Byusingthepracticefiles,you
won'twastetimecreatingfilesthataren'trelevanttotheexercise.Thefiles
andthestep-by-stepinstructionsinthelessonsalsoletyoulearnbydoing,
whichisaneasyandeffectivewaytoacquireandremembernewskills.
InstallingthePracticeFiles
Followthesestepstoinstallthepracticefilesonyourcomputer'sharddisk
sothatyoucanusethemwiththeexercisesinthisbook.
1. RemovetheCDfromthepackageinsidethisbook,andinsertitinto
yourCD-ROMdrive.
NOTE
Anenduserlicenseagreementshouldopenautomatically.Ifthis
agreementdoesnotappear,openMyComputeronthedesktoporStart
menu,double-clicktheiconforyourCD-ROMdrive,andthendoubleclickStartCD.exe.
2. Reviewtheenduserlicenseagreement.Ifyouaccepttheterms,select
theacceptoptionandthenclickNext.
Amenuwillappearwithoptionsrelatedtothebook.
3. ClickInstallPracticeFiles.
4. Followtheonscreeninstructions.
Thepracticefilesareinstalledtothefollowinglocationonyour
computer:
MyDocuments\MicrosoftPress\VisualCSharpStepbyStep
ConfiguringSQLServerExpressEdition
TheexercisesinPartVofthisbookrequirethatyouhaveaccesstoSQL
ServerExpressEditiontocreateandusetheNorthwindTradersdatabase.If
youareusingSQLServer2005ExpressEdition,loginasAdministratoron
yourcomputerandfollowthesestepstograntaccesstotheuseraccountthat
youwillbeusingforperformingtheexercisesinthesechapters.
1. OntheWindowsStartmenu,clickAllPrograms,clickAccessories,and
thenclickCommandPrompttoopenacommandpromptwindow.
2. Inthecommandpromptwindow,typethefollowingcommand:
sqlcmd–SYourServer\SQLExpress–E
ReplaceYourServerwiththenameofyourcomputer.
Youcanfindthenameofyourcomputerbyrunningthehostname
commandinthecommandpromptwindow,beforerunningthesqlcmd
command.
3. Atthe1>prompt,typethefollowingcommand,includingthesquare
brackets,andthenpressEnter:
sp_grantlogin[YourServer\UserName]
ReplaceYourServerwiththenameofyourcomputer,andreplace
UserNamewiththenameoftheuseraccountyouwillbeusing.
4. Atthe2>prompt,typethefollowingcommandandthenpressEnter:
go
Ifyouseeanerrormessage,ensureyouhavetypedthe
sp_grantlogincommandcorrectly,includingthesquarebrackets.
5. Atthe1>prompt,typethefollowingcommand,includingthesquare
brackets,andthenpressEnter:
sp_addsrvrolemember[YourServer\UserName],dbcreato
6. Atthe2>prompt,typethefollowingcommandandthenpressEnter:
go
Ifyouseeanerrormessage,makesureyouhavetypedthe
sp_addsrvrolemembercommandcorrectly,includingthesquare
brackets.
7. Atthe1>prompt,typethefollowingcommandandthenpressEnter:
exit
8. Closethecommandpromptwindow.
UsingthePracticeFiles
Eachchapterinthisbookexplainswhenandhowtouseanypracticefiles
forthatchapter.Whenit'stimetouseapracticefile,thebookwilllistthe
instructionsforhowtoopenthefile.Thechaptersarebuiltaroundscenarios
thatsimulaterealprogrammingprojects,soyoucaneasilyapplytheskills
youlearntoyourownwork.
Forthoseofyouwholiketoknowallthedetails,here'salistoftheVisual
C#projectsonthepracticedisk.
Project
Description
Chapter1
TextHello
Thisprojectgetsyoustarted.Itstepsthroughthe
creationofasimpleprogramthatdisplaysatextbasedgreeting.
WinFormHello
Thisprojectdisplaysthegreetinginawindowby
usingWindowsForms.
Chapter2
PrimitiveDataTypes
Thisprojectdemonstrateshowtodeclarevariables
ofeachoftheprimitivetypes,howtoassignvalues
tothesevariables,andhowtodisplaytheirvalues
inawindow.
MathsOperators
Thisprogramintroducesthearithmeticoperators(+
–*/%).
Chapter3
Methods
Inthisproject,you'llre-examinethecodeinthe
previousprojectandinvestigatehowitisstructured
byusingmethods.
DailyRate
Thisprojectwalksyouthroughwritingyourown
methods(bothmanuallyandbyusingawizard),
runningthemethods,andsteppingthroughthe
methodcallsbyusingtheVisualStudiodebugger.
Chapter4
Selection
Thisprojectshowshowacascadingifstatementis
usedtocomparetwodates.
switchStatement
Thissimpleprogramusesaswitchstatementto
convertcharactersintotheirXMLrepresentations.
Chapter5
Iteration
Thisprojectdisplayscodefragmentsforeachofthe
differentiterationstatementsandtheoutputthat
eachgenerates.
whileStatement
Thisprojectusesawhilestatementtoreadthe
contentsofasourcefileonelineatatimeand
displayeachlineinaWindowstextbox.
doStatement
Thisprojectusesadostatementtoconverta
numbertoitsstringrepresentation.
Chapter6
MathsOperators
Thisprojectre-examinestheMathsOperators
projectfromChapter2,“WorkingwithVariables,
Operators,andExpressions,”andcausesvarious
unhandledexceptionstomaketheprogramfail.
Thetryandcatchkeywordsthenmakethe
applicationmorerobustsothatitnolongerfails.
Chapter7
Classes
Chapter8
Thisprojectcoversthebasicsofdefiningyourown
classes,completewithpublicconstructors,
methods,andprivatefields.Italsocoverscreating
classinstancesbyusingthenewkeywordandby
usingstaticmethodsandfields.
Parameters
Thisprograminvestigatesthedifferencebetween
valueparametersandreferenceparameters.It
demonstrateshowtousetherefandoutkeywords.
Chapter9
StructsAndEnums
Thisprojectusesanenumtypetorepresentthefour
differentsuitsofaplayingcard,andthenusesa
structtypetorepresentacalendardate.
Chapter10
Aggregates
Thisprojectbuildsonthepreviousprojectbyusing
theArrayListcollectionclasstogrouptogether
playingcardsinahand.
Chapter11
ParamsArrays
Thisprojectdemonstrateshowtousetheparams
keywordtocreateasinglemethodthatcanaccept
anynumberofintargumentsandfindandreturn
theonewiththesmallestvalue.
Chapter12
CSharp
Thisprojectusesahierarchyofinterfacesand
classestosimulatebothreadingaC#sourcefile
andclassifyingitscontentsintovariouskindsof
tokens(identifiers,keywords,operators,andsoon).
Asanexampleofuse,italsoderivesclassesfrom
thekeyinterfacestodisplaythetokensinarichtext
boxincolorsyntax.
Chapter13
UsingStatement
Thisprojectrevisitsasmallpieceofcodefromthe
previouschapterandrevealsthatitisnot
exception-safe.Itshowsyouhowtomakethecode
exception-safewithausingstatement.
Chapter14
Properties
ThisprojectpresentsasimpleWindowsapplication
thatusesseveralpropertiestocontinuallydisplay
thesizeofitsmainwindow.
Chapter15
Indexers
Thisprojectusestwoindexers:onetolookupa
person'sphonenumberwhengivenaname,andthe
othertolookupaperson'snamewhengivena
phonenumber.
Chapter16
Delegates
Thisprojectdisplaysthetimeindigitalformatby
usingdelegatecallbacks.Thecodeisthen
simplifiedbyusingevents.
Chapter17
BinaryTree
ThisprojectshowsyouhowtouseGenericsto
buildatypesafestructurethatcancontainelements
ofanytype.
BuildTree
ThisprojectdemonstrateshowtouseGenericsto
implementatypesafemethodthatcantake
parametersofanytype.
Chapter18
BinaryTree
Thisprojectshowsyouhowtoimplementthe
genericIEnumerator<T>interfacetocreatean
enumeratorforthegenericBinaryTreeclass.
IteratorBinaryTree
ThisprojectusesanIteratortogeneratean
enumeratorforthegenericBinaryTreeclass.
Chapter19
Operators
Thisprojectbuildsthreestructs,calledHour,
Minute,andSecond,thatcontainuser-defined
operators.Thecodeisthensimplifiedbyusinga
conversionoperator.
Chapter20
BellRingers
ThisprojectisaWindowsFormsapplication
demonstratingbasicWindowsFormscontrols.
Chapter21
BellRingers
Thisprojectisanextensionoftheapplication
createdinChapter20,“IntroducingWindows
Forms,”butwithdrop-downandpop-upmenus
addedtotheuserinterface.
Chapter22
CustomerDetails
Thisprojectdemonstrateshowtovalidateuser
input,usingcustomerinformationasanexample.
Chapter23
DisplayProducts
ThisprojectshowsyouhowtouseMicrosoft
ADO.NETtoconnecttotheNorthwindTraders
database,andretrieveinformationfromthe
Productstable.TheprojectusestheDataSource
ConfigurationWizardtogenerateadatasourceto
connecttothedatabase,andDataSet,DataTable,
andTableAdapterobjectstobindthedatasourceto
aDataGridViewcontrol.TheDataGridViewcontrol
displaysthedatainaWindowsForm.
ReportOrders
Thisprojectshowshowtoaccessadatabaseby
usingADO.NETcoderatherthanbyusingthe
componentsgeneratedbytheDataSource
ConfigurationWizard.Theapplicationretrieves
informationfromtheOrderstableintheNorthwind
Tradersdatabase.
Chapter24
ProductsMaintenance ThisprojectdemonstrateshowtousetheDataSet,
DataTable,andTableAdaptercomponentstoupdate
informationinadatabase.Theapplicationusesa
DataGridViewcontrolonaWindowsFormand
enablestheusertomodifyinformationinthe
ProductstableintheNorthwindTradersdatabase.
Chapter25
HonestJohn
ThisprojectcreatesasimpleMicrosoftASP.NET
Websitethatenablestheusertoinputinformation
aboutemployeesworkingforafictitioussoftware
developmentcompany.
Chapter26
HonestJohn
Thisprojectisanextendedversionofthe
HonestJohnprojectfromthepreviouschapterand
showshowtovalidateuserinputinanASP.NET
Webapplication.
Chapter27
Northwind
ThisprojectshowshowtouseForms-based
securityforauthenticatingtheuser.Theapplication
alsodemonstrateshowtouseADO.NETfroman
ASP.NETWebform,showinghowtoqueryand
updateadatabaseinascalablemanner.
Chapter28
NorthwindServices
ThisprojectimplementsaWebservice,providing
remoteaccessacrosstheInternettodatainthe
ProductstableintheNorthwindTradersdatabase.
ProductInfo
ThisprojectshowshowtocreateaWindows
applicationthatconsumesaWebservice.Itshows
howtoinvoketheWebmethodsinthe
NorthwindServicesWebservice.
Inadditiontotheseprojects,severalprojectshavesolutionsavailableforthe
practiceexercises.ThesolutionsforeachprojectareincludedontheCDin
thefolderforeachchapterandarelabeledComplete.
UninstallingthePracticeFiles
Followthesestepstoremovethepracticefilesfromyourcomputer.
1. InControlPanel,openAddOrRemovePrograms.
2. FromtheCurrentlyInstalledProgramslist,selectMicrosoftVisualC#
2005StepByStep.
3. ClickRemove.
4. Followtheonscreeninstructionstoremovethepracticefiles.
SupportforthisBook
Everyefforthasbeenmadetoensuretheaccuracyofthisbookandthe
contentsofthecompanionCD.Ascorrectionsorchangesarecollected,they
willbeaddedtoaMicrosoftKnowledgeBasearticle.Toviewthelistof
knowncorrectionsforthisbook,visitthefollowingarticle:
/>MicrosoftPressprovidessupportforbooksandcompanionCDsatthe
followingWebsite:
/>
QuestionsandComments
Ifyouhavecomments,questions,orideasregardingthebookorthis
companionCD,orquestionsthatarenotansweredbyvisitingthesites
above,pleasesendthemtoMicrosoftPressviae-mailto:
Orviapostalmailto:
MicrosoftPress
Attn:StepbyStepSeriesEditor
OneMicrosoftWay
Redmond,WA98052-6399
Pleasenotethatproductsupportisnotofferedthroughthesemailaddresses.
PartI
IntroducingMicrosoftVisualC#and
MicrosoftVisualStudio2005
Chapter1
WelcometoC#
Aftercompletingthischapter,youwillbeableto:
UsetheVisualStudio2005programmingenvironment.
CreateaC#consoleapplication.
Usenamespaces.
CreateaC#WindowsFormsapplication.
MicrosoftVisualC#isMicrosoft'spowerful,component-orientedlanguage.
C#playsanimportantroleinthearchitectureoftheMicrosoft.NET
Framework,andsomepeoplehavedrawncomparisonstotherolethatC
playedinthedevelopmentofUNIX.Ifyoualreadyknowalanguagesuchas
C,C++,orJava,you'llfindthesyntaxofC#reassuringlyfamiliarbecauseit
usesthesamecurlybracketstodelimitblocksofcode.However,ifyouare
usedtoprogramminginotherlanguages,youshouldsoonbeabletopickup
thesyntaxandfeelofC#;youjustneedtolearntoputthecurlybracketsand
semi-colonsintherightplace.Hopefullythisisjustthebooktohelpyou!
InPartI,you'lllearnthefundamentalsofC#.You'lldiscoverhowtodeclare
variablesandhowtouseoperatorssuchasplus(+)andminus(-)tocreate
values.You'llseehowtowritemethodsandpassargumentstomethods.You'll
alsolearnhowtouseselectionstatementssuchasifanditerationstatements
suchaswhile.Finally,you'llunderstandhowC#usesexceptionstohandle
errorsinagraceful,easy-to-usemanner.ThesetopicsformthecoreofC#,and
fromthissolidfoundation,you'llprogresstomoreadvancedfeaturesinPartII
throughPartVI.
BeginningProgrammingwiththeVisualStudio2005
Environment
VisualStudio2005isatool-richprogrammingenvironmentcontainingall
thefunctionalityyou'llneedtocreatelargeorsmallC#projects.Youcan
evencreateprojectsthatseamlesslycombinemodulesfromdifferent
languages.Inthefirstexercise,you'llstarttheVisualStudio2005
programmingenvironmentandlearnhowtocreateaconsoleapplication.
CreateaconsoleapplicationinVisualStudio2005
1. InMicrosoftWindows,clicktheStartbutton,pointtoAllPrograms,
andthenpointtoMicrosoftVisualStudio2005.
2. ClicktheMicrosoftVisualStudio2005icon.VisualStudio2005starts.
NOTE
IfthisisthefirsttimethatyouhaverunVisualStudio2005,youmight
seeadialogboxpromptingyoutochooseyourdefaultdevelopment
environmentsettings.VisualStudio2005cantailoritselfaccording
yourpreferreddevelopmentlanguage.Thevariousdialogboxesand
toolsintheintegrateddevelopmentenvironment(IDE)willhavetheir
defaultselectionssetforthelanguageyouchoose.SelectVisualC#
DevelopmentSettingsfromthelist,andthenclicktheStartVisual
Studiobutton.Afterashortdelay,theVisualStudio2005IDEappears.
3. OntheFilemenu,pointtoNew,andthenclickProject.TheNew
Projectdialogboxopens.Thisdialogboxallowsyoutocreateanew
projectusingvarioustemplates,suchasWindowsApplication,Class
Library,andConsoleApplication,thatspecifythetypeofapplication
youwanttocreate.
NOTE
TheactualtemplatesavailabledependontheversionofVisualStudio
2005youareusing.Itisalsopossibletodefinenewprojecttemplates,
butthatisbeyondthescopeofthisbook.