Reputation: 15787
For example please see the code below:
Public sub routine1(byval strParam as string)
End sub
Public sub routine2()
Dim intTest As Integer
intTest = 1
routine1(intTest)
End sub
Is it bad practice to rely on an implicit cast like in the above or is it important to always use an explicit cast. An explicit cast in the code above seems to be a waste to me.
Upvotes: 0
Views: 47
Reputation: 224857
Leaving Option Strict
on is generally considered good practice in VB.NET, because it can catch a lot of mistakes (and most people have it on anyways, so you may as well for compatibility). This code won’t work under Option Strict
, so you should use ToString()
, yes.
Upvotes: 3