Is there any dark, obscured way to convert all of the method parameters to an object[]?
While implementing the integration between two systems using a message broker, I noticed that most of the methods exposed by the broker uses a lot of parameters.
I want an easy way to log each call to the broker with every parameter. Something like:
[WebMethod]
public void CreateAccount(string arg1, int arg2, DateTime arg3, ... ) {
object[] args = GetMethodArgs();
string log = args.Aggregate("", (current, next) => string.Format("{0}{1};", current, next));
Logger.Log("Creating new Account: " + args);
// create account logic
}
I'm curious if C# provides something that simulates GetMethodArgs();