ASP.Net/Language Basics/Shared
Версия от 15:30, 26 мая 2010; (обсуждение)
<%@ page language="vb" runat="server" %>
<script runat="server">
Public Class User
Private Shared _Count = 0
Public ReadOnly Shared Property Count As Integer
Get
Return _Count
End Get
End Property
Sub New()
_Count += 1
End Sub
End Class
Sub Page_Load()
Response.Write("User.Count = " & User.Count)
Response.Write("<hr/>Creating User Alex.")
Dim Alex As New User()
Response.Write("<br/>Alex.Count = " & Alex.Count)
Response.Write("<hr/>Creating User Rob.")
Dim Rob As New User()
Response.Write("<br/>Rob.Count = " & Rob.Count)
Response.Write("<hr/>Creating User Jake.")
Dim Jake As New User()
Response.Write("<br/>Jake.Count = " & Jake.Count)
Response.Write("<hr/>User.Count = " & User.Count)
End Sub
</script>