有没有办法使用字符串格式化程序将 bool 类型转换为“ON”/“OFF”,例如:
Dim inpValue as Boolean
Dim outValue = String.Format("0:ON;OFF", inpValue)
' should show OFF as output
没有代码或 IFormatProvider?
最佳答案
有什么问题:
Dim inpValue as Boolean
Dim outValue = If(inpValue, "ON", "OFF")
关于vb.net - 如何使用String.Format将 bool 类型转换为 "ON" "OFF",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4589001/