Translating C# to vb.net

I have tried and online translation from C# to VB.NET of the code show below but it didn't come out well

 The original:

    private string GridViewSortDirection

    {

        get { return ViewState["SortDirection"] as string ?? "ASC"; }

        set { ViewState["SortDirection"] = value; }

    }

 

    private string GridViewSortExpression

    {

        get { return ViewState["SortExpression"] as string ?? string.Empty; }

        set { ViewState["SortExpression"] = value; }

    }

 

The result:

 

    Private Property GridViewSortDirection As String
        Get
            Return
            
"ASC"
        
End Get
        Set
            
ViewState("SortDirection"value
        
End Set
    End Property
    
    Private Property 
GridViewSortExpression As String
        Get
            Return
            Dim 
As String
            
Empty
        
End Get
        Set
            
ViewState("SortExpression"value
        
End Set

 


Jean-Luc


www.corobori.com
1
Corobori
12/20/2007 3:30:29 PM
asp.net.getting-started 91979 articles. 2 followers. Follow

1 Replies
451 Views

Similar Articles

[PageSpeed] 43

How about this? 

Private Property GridViewSortDirection() As String
	Get
		If ViewState("SortDirection") Is Nothing Then
			ViewState("SortDirection") = "ASC"
		End If

		Return ViewState("SortDirection").ToString
	End Get
	Set(ByVal value As String)
		ViewState("SortDirection") = value
	End Set
End Property

Private Property GridViewSortBLOCKED EXPRESSION As String
	Get
		If ViewState("SortExpression") Is Nothing Then
			ViewState("SortExpression") = String.Empty
		End If

		Return ViewState("SortExpression").ToString
	End Get
	Set(ByVal value As String)
		ViewState("SortExpression") = value
	End Set
End Property

Thanks, Ed

Microsoft MVP - ASP/ASP.NET

1
ecbruck
12/20/2007 3:53:59 PM
Reply: