单项选择题
You work as an application developer at Certkiller .com. You have recently created a custom collection class named ShoppingList for a local supermarket. This custom class will include ShoppinItem objects that have the public properties listed below. * Name * AisleNumber * OnDiscount You are required to enable users of your class to iterate through the ShoppingList collection, and to list each product name and aisle number using the foreach statement.You need to achieve this by declaring the appropriate code.What code should you use?()
A. public class ShoppingList : ICollection {// Class implementation }
B. public class ShoppingList : IEnumerator, IEnumerable {// Class implementation }
C. public class ShoppingList : Ilist {// Class implementation }
D. public class ShoppingList : Enum {// Class implementation }
相关考题
-
单项选择题
YouworkastheapplicationdeveloperatCertkiller.com.Certkiller.comusesVisualStudio.NET2005asitsapplicationdevelopmentplatform.YouhaverecentlyfinisheddevelopmentofaclassnamedTestRewardandpackagetheclassina.NET2.0assemblynamedTestObj.dll.Afteryoushiptheassemblyanditisusedbyclientapplications,youdecidetomovetheTestRewardclassfromTestObj.dllassemblytotheTestRewardObj.dllAssembly.YouaretoensurewhenyoushiptheupdatedTestObj.dllandTestRewardObj.dllassembliesthattheclientapplicationscontinuetoworkanddonotrequirerecompiling.Whatshouldyoudo?()
A. The TypeForwardedTo attribute should be used
B. The TypeConvertor.ConvertTo method should be used
C. The InternalsVisibleTo attribute should be used
D. The Type Convertor.ConvertFrom method should be used -
单项选择题
YouworkasanapplicationdeveloperatCertkiller.com.YouarecurrentlyintheprocessofcreatingaclassthatstoresdataaboutCertkiller.com’scustomers.Certkiller.comcustomersareassigneduniqueidentifiersandvariouscharacteristicsthatmayincludealiases,shippinginstructions,andsalescomments.Thesecharacteristicscanchangeinbothsizeanddatatype.YoustartbydefiningtheCustomerclassasshownbelow:publicclassCustomer{privateintcustID;privateArrayListattributes;publicintCustomerID{get{returncustID;}}publicCustomer(intCustomerID){this.custID=CustomerID;this.attributes=newArrayList();}publicvoidAddAttribute(objectatt){attributes.Add(att);}}YouhavetocreatetheFindAttributemethodforlocatingattributesinCustomerobjectsnomatterwhatthedatatypeis.YouneedtoensurethattheFindAttributemethodreturnstheattributeiffound,andyoualsoneedtoensuretype-safetywhenreturningtheattribute.Whatshouldyoudo?()
A. Use the following code to declare the FindAttribute method: public T FindAttribute (T att) {//Find attribute and return the value }
B. Use the following code to declare the FindAttribute method: public object FindAttribute (object att) {//Find attribute and return the value }
C. Use the following code to declare the FindAttribute method: public T FindAttribute(T att) {//Find attribute and return the value }
D. Use the following code to declare the FindAttribute method: public string FindAttribute (string att) {//Find attribute and return the value } -
单项选择题
YouworkastheapplicationdeveloperatCertkiller.com.Certkiller.comusesVisualStudio.NET2005asitsapplicationdevelopmentplatform.Youareintheprocessofstoringnumericalvaluesupto2,100,000,000intoavariableandmayrequirestoringnegativevaluesusinga.NETFramework2.0application.Youarerequiredtooptimizememoryusage.Whatshouldyoudo?()
A. Int32
B. UInt16
C. UInt32
D. Int16
