全文预览

C#代码重构

上传者:蓝天 |  格式:pdf  |  页数:53 |  大小:5623KB

文档介绍
placeWithPolymorphism.After\r(\rpublic abstract class Customer\r{\rpublic abstract decimal Discountpercentage { get;}\r)\rpublic class Employee : Customer\r(\rpublic override decimal Discountpercentage\r(\rget { return 0.15m;}\r)\r}\rpublic class NonEmployee : Customer\r(\rpublic override decimal Discountpercentage\r(\rget { return 0.05m;}\r}\r)\rpublic class OrderProcessor\r(\rpublic decimal ProcessOrder(Customer customer, IEnumerable<Product> products)\r(\r// do some processing of order\rdecimal orderTotal = products.Sum(p => p.Price);\rorderTotal -= orderTotal * customer.DiscountPercentage;\rreturn orderTotal;\r)\r).\r??\r”=2>??@AB"p?'>-‰5Š‹ŒŽ<r/\n‘’“”•\r–—Ž˜z™š›[\nœwtžŸ2™š ¡>\nAB¢-€£ƒ¤\r•¥¦#6Ji§\n¨©0

收藏

分享

举报
下载此文档