Hidden Features of VB.NET?
hidden-features, vb.net
Solution
The `Exception When` clause is largely unknown.
Consider this:
Public Sub Login(host as string, user as String, password as string, _
Optional bRetry as Boolean = False)
Try
ssh.Connect(host, user, password)
Catch ex as TimeoutException When Not bRetry
''//Try again, but only once.
Login(host, user, password, True)
Catch ex as TimeoutException
''//Log exception
End Try
End Sub
Problem
I have learned quite a bit browsing through Hidden Features of C# and was surprised when I couldn't find something similar for VB.NET. So what are some of its hidden or lesser known features?
Related problems
- Strangest language feature
- Using the typical get set properties in C#... with parameters
- NUnit vs. Visual Studio 2008's test projects for unit testing
- How should I cast in VB.NET?
- Should I always use the AndAlso and OrElse operators?
- Hidden Features of C#?
- How Do VB.NET Optional Parameters work 'Under the hood'? Are they CLS-Compliant?
- VB.NET Trying to modify a generic Invoke method to a generic BeginInvoke method, having unexpected problems