YouareemployedasaWebApplicationDeveloperatCertkiller.com.YoumakeuseofMicrosoft.NETFrameworkv3.5tocreateanASP.NETapplication.Youcreateaclassintheapplicationthatcontainsthecodebelow.(Thelinenumbersisincludedforreferencepurposes)01publicobjectGetCachedProduc

题目

YouareemployedasaWebApplicationDeveloperatCertkiller.com.YoumakeuseofMicrosoft.NETFrameworkv3.5tocreateanASP.NETapplication.

Youcreateaclassintheapplicationthatcontainsthecodebelow.(Thelinenumbersisincludedforreferencepurposes)

01publicobjectGetCachedProducts(sqlConnectionconn){

02

03if(Cache["products"]==null){

04SqlCommandcmd=newSqlCommand("SELECT*FROMProducts",conn);

05conn.Open();

06Cache.Insert("products",GetData(cmd));

07conn.Close();

08}

09returnCache["products"];

10}

11

12publicobjectGetData(SqlCommandprodCmd){

13

14}

YounoticethattheGetCachedProductsmethodiscalledtoprovidethislistfromtheCacheobjecteverytimeaWebformhastoaccessalistofproducts.ToensureproductivitymanagementwantsyoutomakesurethatthereisalwaysalistofproductsavailableintheCacheobject.Youthusneedtodeterminetheappropriatecodethatshouldbeaddedinline13.

Whatshouldyouidentify?()


相似考题
参考答案和解析
参考答案:D