私はあなたの質問を「特定の規則が与えられた長方形のセットを表す問題をどのようにモデル化するか」と解釈しました。
集合論では、要素を受け取り、その要素が集合に含まれているかどうかを通知する特性関数を定義することにより、集合を定義できます。その特性関数は、c#の述語によって便利にモデル化できます。
したがって、このRectangleクラスがあるとしましょう。
public class Rectangle
{
public int height {get; private set;}
public int width {get; private set;}
public Rectangle(int height, int width)
{
this.height=height;
this.width=width;
}
public int Area {
get {return height*width;}
}
}
これで、グループを述語として定義できます。たとえば、次のような小さな長方形のセットを定義できます。
Predicate<Rectangle> SmallRectangles = r => r.Area < 100;
または、次のように狭い長方形と高い長方形のセットを定義できます。
Predicate<Rectangle> NarrowAndTallRectangles = r => r.width/r.height > 1000;
使用方法は次のとおりです。
var test = new Rectangle(1,2);
Console.WriteLine("is it small? {0}" ,SmallRectangles(test));
Console.WriteLine("is it narrow and tall? {0}" ,NarrowAndTallRectangles(test));
// output:
// is it small? True
// is it narrow and tall? False