Automating populating list of function dependencies

86 Views Asked by At

I have a set of data inputs X.

I then have a set of functions F that each act on X and F (members of F can recurse)

I would like to build a dependency graph of F and X on the fly. Each f_i() take and integer argument i.e f_i(3)

how can this be done in cases such as:

f_1(......){

If x then f_2() else f_3() }

1

There are 1 best solutions below

0
On

Not sure that I fully understand your question but you can use reflection in C# to find about anything you want to know about a function and a variable.

Read about System.Refection

then maybe do something like this

MemberInfo [] infos = myType.GetMembers();
Object var = _something_;

foreach(info in infos)
{
   if (info.ReturnType == typeof(var))
   { 
      info.Invoke(this,new object[]{var});
   }
}

more info here http://msdn.microsoft.com/en-us/library/system.reflection.memberinfo.aspx