Esempio n. 1
0
 /// <summary>
 /// Construct a <see cref="SFunc{A, B, R}"/>.
 /// </summary>
 /// <param name="func">
 ///   A public method (instance or static) castable to
 ///   <see cref="Func{A,B,R}" /> If an instance method, the object must be
 ///   serializable.
 /// </param>
 /// <param name="obj">
 ///   If <paramref name="func" /> is an instance method then this must be
 ///   an appropriate and serializable object. Otherwise, if it is a static
 ///   method then this must be null.
 /// </param>
 public SFunc(object obj, MethodInfo func)
 {
     Contract.Requires
         (func.GetParameters().Equals(new Type[] { typeof(A), typeof(B) }) &&
         func.ReturnType.Equals(typeof(R)) &&
         ((!func.IsStatic && obj != null) ||
          (func.IsStatic && obj == null)
         )
         );
     Data = new SFuncData
     {
         DeclaringTypeName = func.DeclaringType.AssemblyQualifiedName
         , MethodName      = func.Name
         , Instance        = obj
     };
 }
Esempio n. 2
0
 private SFunc(SFuncData data)
 {
     Data = data;
 }