How can I create a nullable numeric optional parameter in VB.NET?
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.
EDIT: this should be possible in VB.NET 10 according to this blog post. If you’re using it then you could have:
For versions other than VB.NET 10:
Your request is not possible. You should either use an optional parameter, or a nullable. This signature is invalid:
You would get this compile error: “Optional parameters cannot have structure types.”
If you’re using a nullable then set it to Nothing if you don’t want to pass it a value. Choose between these options:
or