Other developers do not expect parameters being passed in to be modified, so don't change them unless you document very clearly the reasons why.

Exception: If a parameter must be modified (a typical example is a method that produces multiple output items), the only parameter that is expected to be modified should be marked “...Result” or “...Output” and should always be the last parameter in the method call.

Exception: Sometimes it is acceptable to set an input parameter if it is null or invalid, so the rest of the method can succeed.  This should only be done at the top of the method.

blog comments powered by Disqus