With C#
I want to my delegate method into one dictionary, and put them all out and run.
for example
class class1{
Func<string,int> method1 = new Func<string,int>( x => 3);
Func<int,double> method2 = new Func<string,int>( x => 3.0);
Func<double,bool> method3 = new Func<string,int>( x => true);
Dictionary<string, dynamic> dic = new Dictionary<string, dynamic>();
dic.add("m1",method1)
dic.add("m2",method2)
dic.add("m3",method3)
// rund all method
dynamic RunMethod(Dictionary<string, dynamic> dic , dynamic firstInput, int index = 0)
{
if(index = dic.count) return
RunMethod(dic, dic.ElementAt[index].value(input) , index + 1)
}
void main ()
{
RunMethod( dix , "firstString" )
}
}
(this code has error but expression of what i want to do )
What i want to do is like below.
- Create Method 1, 2 ,3
-
Output type of Method 1 = Input type of Method2 , Output type of Method 2 = Input type of Method3 Finally get output of Method3
-
There is Run Method that take Input that has type of method1 and method dictionary (or list or something)
-
I want to additional method that check what type of method 1? and output type of method 3
Aucun commentaire:
Enregistrer un commentaire