Ideally, in scenarios where myFlag is false we’d like a call to this method, such as the following, to have limited overhead:

MyConditionalMethod("{0}, {1}", param0, param1);

If param0 and/or param1 are value-types, this call will incur the overhead of boxing regardless of the value of myFlag. Obviously, things get worse as we pass more value-types as parameters.

One approach to addressing this problem is through the use of lambda expressions; the lambda expression is only executed if the flag is set. Here’s a version of MyConditionalMethod modified accordingly: