资源描述:
《c# how to program42_3》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、csphtp1.bookPage1324Wednesday,November21,200112:48PM1324VisualStudio.NETDebuggerAppendixDControlButtonShortcutKeyDescriptionContinueF5Continuesprogramexecution.Executioncontinuesuntileitherabreakpointisencounteredortheprogramends(throughnormalexecution).StopDebuggingShift+F5Stopsdebu
2、ggingandreturnstoVisualStudiodesignmode.StepOverF10Advancestonextstatement,doesnotstepintomethodcalls.StepIntoF11Executesnextstatement.Ifthestatementcontainsamethodcall,controltransferstothemethodforline-by-linedebugging.Ifthestatementdoesnotcontainamethodcall,StepIntobehaveslikeStep
3、Over.StepOutShift+F11Finishesexecutingthecurrentmethodandsuspendsprogramexecutioninthecallingmethod.Fig.D.19Debugprogramcontrolfeatures.ProgrammerscanusetheImmediatewindow,discussedinSectionD.3fortestingmethodargumentspassedtoamethod(Fig.D.20).Testingtheargumentshelpsdetermineifameth
4、odisfunctioningproperly.D.6AdditionalClassDebuggingCapabilitiesInmostsophisticatedC#programs,alargeportionofprogramdataiscontainedinobjects.Forthesepurposes,VisualStudioincludesclassdebuggingfeatures,whichallowprogram-merstodeterminethecurrentstateofobjectsusedinaprogram.Wedemonstrat
5、esomeclassdebuggingfeaturesusingthecodepresentedinFig.D.21.ToexamineaninstanceofclassDebugEntry,weplaceabreakpointatline43,asshowninFig.D.22.[Note:AC#filemaycontainmultipleclasses,asisthecasewiththisexample.]Fig.D.20UsingtheImmediatewindowtodebugmethods.csphtp1.bookPage1325Wednesday,
6、November21,200112:48PMAppendixDVisualStudio.NETDebugger13251//Fig.D.21:DebugClass.cs2//Consoleapplicationtodemonstrateobjectdebugging.34usingSystem;56namespaceClassDebug7{89//createsarraycontainingthreedifferentclasses10publicclassDebugEntry11{12publicintsomeInteger=123;13privateint[
7、]integerArray={74,101,102,102};14privateDebugClassdebugClass;15privateRandomrandomObject;16privateobject[]list=newobject[3];1718//constructor19publicDebugEntry()20{21randomObject=newRandom();22debugClass=newDebugClass("HelloWorld",23newobject());2425list[0]=integerArray;26list[1]=deb
8、ugClass;27li