将Razor代码从CSHTML转换为VBHTML [英] Converting Razor code from CSHTML to VBHTML

查看:187
本文介绍了将Razor代码从CSHTML转换为VBHTML的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



有谁知道一个工具可以将cshtml文件中的razor语法转换为vbhtml文件?所有lambda表达式都有问题。

Hi Guys,

Does anyone know a tool that would convert razor syntax in a cshtml file to vbhtml file? Having trouble with all the lambda expressions.

推荐答案

据我所知,你唯一的工具就是你的耳朵之间的工具。没有自动转换工具。
As far as I can tell, the only tool you have is one between your ears. There is no automated conversion tool.


@ {
List< menusample.models.menumodel> menuList = ViewBag.Menu;

}

@{ List<menusample.models.menumodel> menuList = ViewBag.Menu;
}


    }



    @ RenderMenuItem(menuList,cp)

    if(menuList.Count(p => p.ParentId == cp.Id)> 0)

    {

    @:

    }

    @RenderMenuItem(menuList,cp)
    if(menuList.Count(p=>p.ParentId == cp.Id) > 0)
    {
    @:


@ {
List menuList = ViewBag.Menu;

$





@foreach(menuList.Where中的var mp(p => p.ParentId == 0)){



@ mp.Name

@if(menuList.Count(p => p.ParentId == mp.Id)> 0){

@:

}



@RenderMenuItem(menuList,mp)



@if(menuList.Count(p => p.ParentId == mp.Id)> 0){

@:

}



}





@helper RenderMenuItem(列表menuList,MenuSample.Models.MenuModel mi)

{

foreach(menuList.Where中的var cp(p => p.ParentId == mi.Id))

{





@:

@ cp.Name



if(menuList.Count(p => p.ParentId == cp.Id)> 0)

{

@:



}



@RenderMenuItem (menuList,cp)

if(menuList.Count(p => p.ParentId == cp.Id)> 0)

{

@:

}

其他

{

@:

}

}

}
@{ List menuList = ViewBag.Menu;
}


@foreach (var mp in menuList.Where(p => p.ParentId == 0)){

@mp.Name
@if( menuList.Count(p=>p.ParentId == mp.Id ) > 0){
@:
}

@RenderMenuItem(menuList,mp)

@if( menuList.Count(p=>p.ParentId == mp.Id ) > 0){
@:
}

}


@helper RenderMenuItem(List menuList,MenuSample.Models.MenuModel mi)
{
foreach (var cp in menuList.Where(p => p.ParentId == mi.Id))
{


@:
@cp.Name

if(menuList.Count(p=>p.ParentId == cp.Id) > 0)
{
@:

}

@RenderMenuItem(menuList,cp)
if(menuList.Count(p=>p.ParentId == cp.Id) > 0)
{
@:
}
else
{
@:
}
}
}


这篇关于将Razor代码从CSHTML转换为VBHTML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆