I have a bunch of methods that look like this:
public void SourceInfo_Get() { MethodInfo mi = pFBlock.SourceInfo.GetType().GetMethod("SendGet"); if (mi != null) { ParameterInfo[] piArr = mi.GetParameters(); if (piArr.Length == 0) { mi.Invoke(pFBlock.SourceInfo, new object[0]); } } } public void SourceAvailable_Get() { MethodInfo mi = pFBlock.SourceAvailable.GetType().GetMethod("SendGet"); if (mi != null) { ParameterInfo[] piArr = mi.GetParameters(); if (piArr.Length == 0) { mi.Invoke(pFBlock.SourceAvailable, new object[0]); } } }
I have one method for each property in my pFBlock object. with such a small change between the methods, I feel that there should be a better way to do this, but I cannot think of anything. I am using VS 2005.
c #
scott
source share