[This is preliminary documentation and subject to change.]
インスタンスメソッドの呼び出しを関数オブジェクトにしたものです
この型のすべてのメンバの一覧については、 MemberFunctor メンバを参照してください。
System.Object
Kodama.Function.Functor.Member.MemberFunctor
この型の public static (Visual Basicでは Shared) のすべてのメンバは、 マルチスレッド操作で安全に使用できます。インスタンスのメンバの場合は、スレッドセーフであるとは限りません。
C++でいうSTL/Boostのmem_funに相当します。
[C#]
// このクラスのメソッドをMemberFunctorをつかって呼び出します
public class TestClass
{
// このメソッドをMemberFunctorをつかって呼び出します
public void Print(string arg1, string arg2, string arg3, string arg4)
{
Console.WriteLine(arg1);
Console.WriteLine(arg2);
Console.WriteLine(arg3);
Console.WriteLine(arg4);
}
}
// この関数を呼ぶと、コンソールに"1"、"2"、"3"、"4"と4行表示されます
public void MemberFunctorTest()
{
// MemberFunctorを生成します
IFunctor functor = new MemberFunctor(typeof(TestClass).GetMethod("Print"));
// MemberFunctorを呼び出します
// この場合、以下のコードと同じ動作になります。
// TestClass ts = new TestClass();
// ts.Print("1", "2", "3", "4");
functor.Invoke(new TestClass(), "1", "2", "3", "4");
}
名前空間: Kodama.Function.Functor.Member
アセンブリ: Kodama.Function (Kodama.Function.dll 内)
MemberFunctor クラス | MemberFunctor メンバ | Kodama.Function.Functor.Member 名前空間 | Boostリファレンス日本語訳