using System.Collections.Generic;
using System.Diagnostics.Contracts;
public abstract class PropDescriptor<TOwner, TProp>
public class ParamDescriptor<TOwner, TProp> : PropDescriptor<TOwner, TProp>
public ParamDescriptor(string name)
public class ResultDescriptor<TOwner, TProp> : PropDescriptor<TOwner, TProp>
public class Test2 : ITask
public static ParamDescriptor<Test2, long> ParamLong = new ParamDescriptor<Test2, long>("ParamLong");
public static ParamDescriptor<Test2, string> ParamString = new ParamDescriptor<Test2, string>("ParamString");
public static ResultDescriptor<Test2, string> Result = new ResultDescriptor<Test2, string>();
public class Test3 : ITask
public static ParamDescriptor<Test3, long> ParamLong = new ParamDescriptor<Test3, long>("ParamLong");
public static ParamDescriptor<Test3, string> ParamString = new ParamDescriptor<Test3, string>("ParamString");
public static ResultDescriptor<Test3, string> Result = new ResultDescriptor<Test3, string>();
public static class Binder
public static void Bind<T1, T2, U1, U2>(T1 x, ParamDescriptor<T1, U1> p, T2 y, ResultDescriptor<T2, U2> r)where T1 : ITask where T2 : ITask where U1:U2
Console.WriteLine("{0}:{1}.{2} bound to {3}:{4}.Result, type {5}", x.GetType().Name, x.ID, p.Name, y.GetType().Name, y.ID, typeof (U2).Name);
[Obsolete("Wrong type of param descriptor", true)]
public static void Bind<T1, T2, U1, U2>(T1 x, U1 p, T2 y, ResultDescriptor<T2, U2> r)where T1 : ITask where T2 : ITask
[Obsolete("Wrong type of result descriptor", true)]
public static void Bind<T1, T2, U1, U2>(T1 x, ParamDescriptor<T1, U1> p, T2 y, U2 r)where T1 : ITask where T2 : ITask
public static void Main(string[] args)
Test2 t_1 = new Test2(1);
Test3 t_2 = new Test3(2);
Binder.Bind(t_1, Test2.ParamString, t_2, Test3.Result);
Binder.Bind(t_1, Test2.ParamString, t_2, Test2.Result);
Binder.Bind(t_1, Test3.ParamString, t_2, Test3.Result);
Binder.Bind(t_1, Test2.ParamLong, t_2, Test3.Result);