多做题,通过考试没问题!

微软认证考试

睦霖题库>其他计算机考试>微软认证考试

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
答案解析:
进入题库查看解析

微信扫一扫手机做题