Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

Properties vb.net

Avatar of vraag
vraag asked on
.NET ProgrammingEditors IDEs
11 Comments1 Solution326 ViewsLast Modified:
Hello,

I did convert a piece of C# source to VB.net
public class properties
{
    private static HttpContext Context { get { return System.Web.HttpContext.Current; } }
    private static HttpSessionState Session { get { return Context.Session; } }

    // Get settings from session
    public static string loggedIn { get { return (Session["Properties.loggedIn"] ?? String.Empty).ToString(); } set { Session["Properties.loggedIn"] = value; } }
    public static string userId { get { return (Session["Properties.userId"] ?? String.Empty).ToString(); } set { Session["Properties.userId"] = value; } }
}

to:
Public Class properties
    Private Shared ReadOnly Property Context() As HttpContext
        Get
            Return System.Web.HttpContext.Current
        End Get
    End Property
    Private Shared ReadOnly Property Session() As HttpSessionState
        Get
            Return Context.Session
        End Get
    End Property

    ' Get settings from session
    Public Shared Property loggedIn() As String
        Get
            Return (If(Session("Properties.loggedIn"), String.Empty)).ToString()
        End Get
        Set(ByVal value As String)
            Session("Properties.loggedIn") = value
        End Set
    End Property
    Public Shared Property userId() As String
        Get
            Return (If(Session("Properties.userId"), String.Empty)).ToString()
        End Get
        Set(ByVal value As String)
            Session("Properties.userId") = value
        End Set
    End Property


End Class

If i run this i get the following error:
Compilation error

Error message from compiler: BC30201: Expressie expected.

Error in source:

 

Regel 25:     Public Shared Property loggedIn() As String
Regel 26:         Get
Regel 27:             Return (If(Session("Properties.loggedIn"), String.Empty)).ToString()
Regel 28:         End Get
Regel 29:         Set(ByVal value As String)
 

Does any one know what goes wrong?

Thanks in advance.
ASKER CERTIFIED SOLUTION
Avatar of vraag
vraag

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Commented:
This problem has been solved!
Unlock 1 Answer and 11 Comments.
See Answers