单项选择题
You work as an application developer at Certkiller .com. Certkiller .com wants you to develop an application that stores and retrieves client information by means of a unique account number.You create a custom collection class, which implements the IDictionary interface,named ClientDictionary. The following code have been included into the new application.
You use the same method to add other Client objects to the collection. You need to ensure that you are able to retrieve client information associated with the account number 10111.What should you do?()
A. Use the following code: Client foundClient;foundClient = (Client) cData.Find ("10111");
B. Use the following code: Client foundClient;if (cData.Contains ("10111")) foundClient = cData ["10111"];
C. Use the following code: Client foundClient;if (cData.Contains ("10111"))foundClient =(Client) cData ["10111"];
D. Use the following code: Client foundClient;foreach (string key in cData.Keys {if (key == "10111")foundClient = (Client) cData.Values ["10111"]; }
相关考题
-
单项选择题
YouworkasanapplicationdeveloperatCertkiller.com.Certkiller.comhasbeenhiredbyasmalllocalprivateschooltodevelopaclasslibrarythatwillbeusedinanapplicationnamedManageAttendanceforthepurposeofmanagingstudentrecords.Youareresponsiblefordevelopingthisclasslibrary.Certkiller.comhasinstructedyoutocreateacollectionintheapplicationtostorelearners’results.Theschoolhasinformedyouthattheycurrentlyonlyhavesevenlearners,butthatthisvaluewilltripleinthefollowingyear.Duetothelimitedresources,youneedtoensurethatthecollectionyoucreateconsumesaminimumamountofresources.Whatshouldyouusetocreatethecollection?()
A. The HybridDictionary collection class.
B. The HashTable collection class.
C. The ListDictionary collection class.
D. The StringCollection collection class. -
单项选择题
YouworkasanapplicationdeveloperatCertkiller.com.Certkiller.comhasbeencontractedtodevelopanapplicationforthelocalbank.Youhavebeengiventheresponsibilityofcreatingthisapplicationandneedtostoreeachtransactionrecord,whichisidentifiedusingacomplextransactionidentifier,inmemory.Thebankinformsyouthatthetotalamountoftransactionrecordscouldreach200perday.Toachievethis,youdecidetoutilizeoneoftheexistingcollectionclassesinthe.NET2.0classlibrary.Youneedtoensurethatyouthecollectionclassyouselectisthemostefficientoneforstoringtransactionrecords.Whatshouldyoudo?()
A. Select the ListDictionary collection class.
B. Select the HashTable collection class.
C. Select the Queue collection class.
D. Select the StringCollection collection class. -
单项选择题
YouworkasanapplicationdeveloperatCertkiller.com.Youarecurrentlyintheprocessofreviewinganapplicationthatwascreatedbyafellowdeveloper.TheapplicationthatyouarereviewingincludesadeclarationforacollectionnamedEmployeeList,whichstoresEmployeeobjects.Thedeclarationisshownbelow:publicclassEmployeeList:Enumerator,IEnumerable{//Classimplementation}YourequiretheabilitytoiteratethroughtheEmployeeListwithminimumdevelopmenteffort.Whatshouldyoudo?()
A. Utilize the switch statement
B. Utilize the dowhile statement
C. Utilize the foreach statement
D. Utilize the if statement
