c# - writing a Switch case -
can please suggest me, there improve way in writing below code using swich case or any(thank giving valuable suggestions here using in linq query , observed modifications contains different product names)
p in l_list ((licencetype == "full" && systemtype == "single") && p.productname != "full doubleproduct ") || ((licencetype == "full" && systemtype == "multiple") && p.productname != "full singleproduct") || ((licencetype == "partial" && systemtype == "single") && p.productname != "locked doubleproduct") || ((licencetype == "partial" && systemsize == "multiple") && p.productname != "locked singleproduct") || ((licencetype == "locked" && systemsize == "single") && p.productname != "locked doubleproduct") || ((licencetype == "locked" && systemtype == "multiple") && p.productname != "locked singleproduct")
that monstrous boolean status describes mutual quality shared among subset of info objects. pinpoint quality , give descriptive name.
then, either expose value of quantity through property on info object, or else write extension method same. finally, replace existing status utilize of accessor.
for example, if name of quality "friendliness" might this:
where model.isfriendly // property
or this:
where model.isfriendly() // extension method businessrules.isfriendly(model m)
c# linq switch-statement
No comments:
Post a Comment