Abdu_Allah
asked on
How to refence a class's member in a shared(static in C#) function
Hi, To better understand my problem please consider the code below. I want to use the member upoadcount in the shared sub DoSomething(..)
Partial Public Class Main
Inherits System.Web.UI.Page
Public uploadcount As Integer = 0
<WebMethod()> _
Public Shared Sub DoSomething(ByVal s As String)
If HttpContext.Current.Session("View") Is Nothing Then
HttpContext.Current.Session("View") = 1 ' 1: Details List
End If
End sub
End Class
A static member cannot access an instance member without creating an instance of that class. Have you considered making "uploadcount" static?
ASKER
I know that and this is why I'm asking this question, I want to know how to do that in the code that I provided.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.