MethodInfo method = typeof(T).GetMethod("Parse", new[] { typeof(string) });
parse = Delegate.CreateDelegate(typeof(Func<T,string>), method);
T is a float in this case. However I am getting a Error binding to target method. Parse I believe is a static method. I have looked at other examples, but I can not figure out why it is not binding.
you have to swap
Tandstringbecause the method returns aTnot astring.I replaced
Twithfloatand following code works for me:source: VS intellisense and MSDN Func(Of T, TResult) Delegate