C # fragmentary knowledge

(1) ref and out can achieve the same effect, are passing reference parameters, you need to give ref parameter assignment before use, not out, out there in the calling function to parameter assignment

 

(2) params, when an incoming is not quantitative parameters, as shown below, do not call when written GreetPersons (25, new string [] { "John", "Jane", "Tarzan"}) to simplify the call statement.

 

  When not using the quantitative parameters params on the back when you need to, even if the incoming parameters have no problem 0


 

 

 foreach applicable to loop through the collection, easy to use

 

Guess you like

Origin www.cnblogs.com/springbrotherhpu/p/11535485.html