Based on some security reviews we are doing on the system in general I added this implementation note to the Design Guidelines.
Do be aware that null could be passed in for the paramarray. You should validate that that paramarray is not null before processing (see section on parameter passing for more infomration).
Sum(1, 2, 3, 4, 5); //result == 15
Sum(null); //throws null reference exception
static int Sum(params int values)
int sum = 0;
foreach (int i in values)
sum += i;