PHP 相关:asp.net 组合模式的一个例子
asp.net 组合模式的一个例子,方便学习 asp.net 的朋友作为参考
代码如下:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace
Test
{
class
Program
{
static
void Main(string[] args)
{
var
customer =
new
Customer
{
IsActive = true,
LateFees = 100M,
TotalRentNumber = 10
};
Console.WriteLine(customer.CanRent());
Console.ReadKey();
}
}
public
interface
ISpecification<T>
{
/// <summary>
///
是否可以租赁
/// </summary>
bool IsSatisfiedBy(T entity);
/// <summary>
///
与操作
/// </summary>
ISpecification<T> And(ISpecification<T> other);
/// <summary>
///
否操作
/// </summary>
ISpecification<T> Not();
}
/// <summary>