试题详情
单项选择题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. //Create Client objects Client c1 = new Client ("AReid", "Andy Reid", Status.Current); Client c2 = new Client ("DAustin", "Dean Austin", Status.New); //Create ClientDictionary object IDictionary cData = new ClientDictionary (); cData.Add ("10001", c1); cData.Add ("10002", c2); 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"]; }

  • C
  • 关注下方微信公众号,在线模考后查看

热门试题