1
任何人都可以看到我在這裏做錯了嗎?該頁面應該「YES這是一個測試」vb.net 4.0 iif問題,當有一個參數集
Partial Public Class testForm1
Inherits System.Web.UI.Page
Private Property test() As String
Get
'if is in session, return it, otherwise look it up
If (IsNothing(Session("test"))) Then
Session("test") = ""
End If
Return Session("test")
End Get
Set(ByVal Value As String)
Session("test") = Value
End Set
End Property
Public ReadOnly Property Istest As Boolean
Get
IIf(test.Contains("yes"), True, False)
End Get
End Property
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
test = "yes"
Response.Write(IIf(Istest, "YES This is a test", "NO testing here"))
End Sub
End Class
+1,但更重要的,只是:'返回test.Contains( 「是」 )'不需要IIf()。 –
好點!感謝那 :) – kiev