为了账号安全,请及时绑定邮箱和手机立即绑定

VB.NET的隐藏功能?

VB.NET的隐藏功能?

烙印99 2019-09-18 10:30:09
我已经学习了很多浏览C#的隐藏功能,当我找不到类似于VB.NET的东西时,我感到很惊讶。那么它的一些隐藏或鲜为人知的特征是什么?
查看完整描述

3 回答

?
海绵宝宝撒

TA贡献1809条经验 获得超8个赞

该Exception When条款基本上未知。


考虑一下:


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


查看完整回答
反对 回复 2019-09-18
?
慕森王

TA贡献1777条经验 获得超3个赞

你有没有注意到Like比较运算符?



    Dim b As Boolean = "file.txt" Like "*.txt"


更多来自MSDN


Dim testCheck As Boolean


' The following statement returns True (does "F" satisfy "F"?)'

testCheck = "F" Like "F"


' The following statement returns False for Option Compare Binary'

'    and True for Option Compare Text (does "F" satisfy "f"?)'

testCheck = "F" Like "f"


' The following statement returns False (does "F" satisfy "FFF"?)'

testCheck = "F" Like "FFF"


' The following statement returns True (does "aBBBa" have an "a" at the'

'    beginning, an "a" at the end, and any number of characters in '

'    between?)'

testCheck = "aBBBa" Like "a*a"


' The following statement returns True (does "F" occur in the set of'

'    characters from "A" through "Z"?)'

testCheck = "F" Like "[A-Z]"


' The following statement returns False (does "F" NOT occur in the '

'    set of characters from "A" through "Z"?)'

testCheck = "F" Like "[!A-Z]"


' The following statement returns True (does "a2a" begin and end with'

'    an "a" and have any single-digit number in between?)'

testCheck = "a2a" Like "a#a"


' The following statement returns True (does "aM5b" begin with an "a",'

'    followed by any character from the set "L" through "P", followed'

'    by any single-digit number, and end with any character NOT in'

'    the character set "c" through "e"?)'

testCheck = "aM5b" Like "a[L-P]#[!c-e]"


' The following statement returns True (does "BAT123khg" begin with a'

'    "B", followed by any single character, followed by a "T", and end'

'    with zero or more characters of any type?)'

testCheck = "BAT123khg" Like "B?T*"


' The following statement returns False (does "CAT123khg" begin with'

'    a "B", followed by any single character, followed by a "T", and'

'    end with zero or more characters of any type?)'

testCheck = "CAT123khg" Like "B?T*"


查看完整回答
反对 回复 2019-09-18
  • 3 回答
  • 0 关注
  • 456 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信