我已经在vb.net中编写了代码,如何在c#.net中编写相同的代码,而代码是 [英] i have written a code in vb.net how to write the same code in c#.net wht is code
本文介绍了我已经在vb.net中编写了代码,如何在c#.net中编写相同的代码,而代码是的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
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
如何将此代码转换为c#.net代码
我曾尝试使用developerfusion.com,但无法正常运行
how to convert this code to c#.net code
i have tried with developerfusion.com but it is not workingk
推荐答案
private SortedList GetCart()
{
if (Session["Cart"] == null) {
Session.Add("Cart", new SortedList());
}
return (SortedList)Session["Cart"];
}
私有SortedList GetCart()
{
if(Session ["Cart"]!== null){
Session.Add(购物车",新的SortedList());
}
return(SortedList)Session ["Cart"];
}
private SortedList GetCart()
{
if (Session["Cart"] !== null) {
Session.Add("Cart", new SortedList());
}
return (SortedList)Session["Cart"];
}
^ ]将节省您的时间.
第一个链接 [
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"];
}
这篇关于我已经在vb.net中编写了代码,如何在c#.net中编写相同的代码,而代码是的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文