但就如SQL 中的where
using System;
using System
using System
namespace ConsoleApplication
{
class C
{
float[] temps = new float[
public float this[int index]
{
get { return temps[index]; }
set { temps[index] = value; }
}
public string this[string index]
{
get { return index; }
}
///
/// 可以提供類似 Federated PK的功能
///
///
///
///
public string this[string index
{
get { return index + i; }
}
///
/// 已經可以非常類似SQL語句中Where子句的效果
///
///
///
public float this[Predicate predicate]
{
get
{
float[] matches = Array
#region 輸出中間結果
string[] info = Array
matches
delegate(float f)
{
return Convert
}
)
Console
#endregion
return matches[
}
}
///
/// 已經可以非常類似SQL語句中一組Where子句的效果
///
///
///
public float this[params Predicate[] predicates]
{
get
{
// 具體實現可以參考上面的例子
// 具體實現略過
return
}
}
}
class Program
{
static void Main(string[] args)
{
C c = new C()
Console
Console
Console
Console
c[
delegate(float f)
{
return f >
}])
}
}
}
From:http://tw.wingwit.com/Article/program/net/201311/12258.html