I would like to do something like this:
public MyFunction(int integerParameter, string stringParameter){
//Do this:
LogParameters();
//Instead of
Unless you use the debugger API, you cannot loop through parameter values of a different method on the call stack. Though you can get the parameter names from the callstack (as others have mentioned).
The closest thing would be:
public MyFunction(int integerParameter, string stringParameter){
LogParameters(integerParameter, stringParameter);
}
public void LogParameters(params object[] values){
// Get the parameter names from callstack and log names/values
}