Does VB.NET have a direct equivalent to C# out function parameters, where the variable passed into a function does not need to be initialised?
Does VB.NET have a direct equivalent to C# out function parameters, where the variable
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
No, there is no equivalent of the
outkeyword in VB.However, VB does automatically initialise all local variables in a method, so you can use
ByRefwithout needing to explicitly initialise the variable first.Example:
(If you examine code in the framework (for example Double.TryParse), you may see the
<OutAttribute>added to parameters, but that only makes a difference when the call is marshalled for COM interop or platform invoke.)