Click here to Skip to main content
16,018,938 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
VB
Private Function GetCart() As SortedList
       If Session("Cart") Is Nothing Then
           Session.Add("Cart", New SortedList)
       End If
       Return CType(Session("Cart"), SortedList)
   End Function



how to convert this code to c#.net code
i have tried with developerfusion.com but it is not workingk
Posted

To convert C# to VB.Net or vice-versa following are the websites which does the job-
http://www.developerfusion.com/tools/convert/csharp-to-vb/[^]
http://converter.telerik.com/[^]
http://www.carlosag.net/tools/codetranslator/[^]
 
Share this answer
 
Comments
deepureddy18 1-Jun-12 8:05am    
private SortedList GetCart()
{
if (Session["Cart"] == null) {
Session.Add("Cart", new SortedList());
}
return (SortedList)Session["Cart"];
}
Hi I can advice to you, to use http://www.developerfusion.com/tools/convert/vb-to-csharp/[^]

I could be useful in such situations as yours.
 
Share this answer
 
Google [^]would have saved your time.

The first link [^]itself is very clear and gives correct result.

private SortedList GetCart()
{
	if (Session["Cart"] == null) {
		Session.Add("Cart", new SortedList());
	}
	return (SortedList)Session["Cart"];
}
 
Share this answer
 
v2
private SortedList GetCart()
{
if (Session["Cart"] !== null) {
Session.Add("Cart", new SortedList());
}
return (SortedList)Session["Cart"];
}
 
Share this answer
 
C#
private SortedList GetCart()
{
    if (Session["Cart"] == null) {
        Session.Add("Cart", new SortedList());
    }
    return (SortedList)Session["Cart"];
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900