【发布时间】:2012-01-19 12:26:35
【问题描述】:
如果我尝试将字符串放入布尔变量中,例如:
Dim testValue As String = "True"
Dim bool1 As Boolean = testValue
Option Strict On 出现错误,建议的解决方法是将第二行更改为:
Dim bool1 As Boolean = CBool(testValue)
这很好,但是 - 这样做的优点/缺点是什么:
Dim bool1 As Boolean = Boolean.Parse(testValue)
CBool 对我来说很像 VB6,但我们应该使用哪个,为什么?
【问题讨论】:
标签: .net vb.net performance types type-conversion