Recursive function with return value VS using OUT parameter
c#, function, out, parameters, recursion
Solution
For me, returning a value will always be the better choice over an out parameter. In my opinion it is more clean and elegant. Take a look at this similar question, and the answer by John skeet.
Also, If you use FxCop, you will get a warning for using out parameters.
Problem
Just a quick question, What do you think is better of the two: ``` - A recursive function that returns a value - A recursive function with an OUT paremeter (which will serve as a return value.) ``` I tried both approach and they worked out the same. Please note that the main functionality of this function is to: ``` -> accept a String parameter. -> scan through a list (whick have like 1032 items) and find a match of the string parameter above. -> then get a specific data from the object that matched the string parameter. ``` Your inputs will be very much appreciated.