Passing Parameters by Reference to a Method
From the CLR’s perspective, out and ref are identical —that is, the same IL is produced egardless of which keyword you use, and the metadata is also identical except for 1 bit, which is used to record whether you specified out or ref when declaring the method. However, the C# compiler treats the two keywords differently, and the difference has to do with which method is responsible for initializing the object being referred to. If a method’s parameter is marked with out, the caller isn’t expected to have initialized the object prior to calling the method. The called method can’t read from the value, and the called method must write to the value before returning. If a method’s parameter is marked with ref, the caller must initialize the parameter’s value prior to calling the method. The called method can read from the value and/or write to the value.
Passing a Variable Number of Arguments to a Method
Calling a method that takes a variable number of arguments incurs an addintional performance hit unless you explicitly pass null . After all ,an array object must be allocated on the heap, the array's elements must be initiaized, and the array's memory must uluimately be garbage collected. To help reduce the performance hit associated with this, you may want to consider defining a few overloaded methods that do not use the params keyword.