I have an ASP.NET book I am going through and unfortunately all the code examples are in VB.NET. So I am in the process of translating everything to C# code. This publisher also does not publish any accompanying examples in C# for this particular book. Because I like the book so much I am going through the pains of translating everything.
One thing I'm learning is that you do a lot more casting in C# than in VB.NET. This particular segment is giving me an error. Please tell me what I am doing wrong.
In the VB.NET code we have:
Cart represents the cart items in session state. This is an e-commerce sample web site.
What would be the equivalent in C#?
In C# I am having trouble accessing the Count property of Session object. If I write Session.Count I get it but if I try to access it with Session["Cart"] I am not able to get a count property.
Please tell me how to fix this...thanks...
One thing I'm learning is that you do a lot more casting in C# than in VB.NET. This particular segment is giving me an error. Please tell me what I am doing wrong.
In the VB.NET code we have:
Code:
If Session("Cart").Count = 0 Then
'ETC
End If
Cart represents the cart items in session state. This is an e-commerce sample web site.
What would be the equivalent in C#?
In C# I am having trouble accessing the Count property of Session object. If I write Session.Count I get it but if I try to access it with Session["Cart"] I am not able to get a count property.
Please tell me how to fix this...thanks...