谁能看到我在这里做错了什么?页面应该是“这是一个测试”
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
答案 0 :(得分:1)
你刚刚错过了Istest中的回归:
Public ReadOnly Property Istest As Boolean
Get
Return IIf(test.Contains("yes"), True, False)
End Get
End Property
有关您的代码的两个提示。
Public ReadOnly Property Istest As Boolean
Get
Return test.Contains("yes")
End Get
End Property