L
lianqtlit
best way to use: an out method parameter or a method with return ?
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Morten Wennevik said:If you only have one return value, creating an out parameter will force the
caller to define the parameter before calling the method. Another issue to
remember is using the return value is optional so you can call the method
without declaring any object for the return value.
In my opinion out parameters are handy when you need to return two or more
values, but should not be used of there is only one return value.
--
Happy Coding!
Morten Wennevik [C# MVP]
lianqtlit said:best way to use: an out method parameter or a method with return ?
No I don't have C++ background
what is a profiler?
what do you ment by code expressive?
Morten Wennevik said:If you only have one return value, creating an out parameter will force the
caller to define the parameter before calling the method. Another issue to
remember is using the return value is optional so you can call the method
without declaring any object for the return value.
In my opinion out parameters are handy when you need to return two or more
values, but should not be used of there is only one return value.
--
Happy Coding!
Morten Wennevik [C# MVP]
lianqtlit said:best way to use: an out method parameter or a method with return ?
In performance wise when both have one return value( out int n & return (int)
n)
which is more costly to use?
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.