0
Questions about the 'out' functionality?
Sorry, it's just kind of blowing my mind and yelling at me that if I attempt to do this then I've done something wrong. I've been programming for 30 years and c# is kind of new to me. It makes it hard to read. And breaks several of the oop and SOLID principles. Do I have it wrong?
1 Réponse
+ 2
out is usually used when you're not sure if the method will succeed but you still want the parameter to be set. one example is this:
public bool a(int b, out int c) {}
here you have the return value indicating whether the method was successful while still retaining a result in the out parameter.
even though it is rarely used, when it is, out is really useful
(also imo it doesn't hurt readability but that's entirely subjective)