簡體   English   中英

將此C#模板轉換為等效的VB

[英]Convert this C# template to VB equivalent

誰能將它翻譯成帶有VB的asp.net MVC的等效語言?

(我正在嘗試將模板DateTime選擇器添加到編輯器模板中-我所能找到的只是C#版本)

@model DateTime

Using Date Template

@Html.TextBox("", String.Format("{0:d}", Model.ToShortDateString()),  new { @class = "datefield", type = "date"  })

我在第一個花括號處出現錯誤,建議使用類型或“ with”。

謝謝你的幫助,

標記

@Html.TextBox("", String.Format("{0:d}", Model.ToShortDateString()), New With {.class = "datefield", .type = "date"})

在“ New With”匿名類型參數之前,您不需要“ @”。

在線有大量的C#到VB轉換器。 這是我使用的輸出。請記住,它們並不是萬無一失的,但它們至少可以為您提供一個起點。 http://www.developerfusion.com/tools/convert/csharp-to-vb/

Html.TextBox("", [String].Format("{0:d}", Model.ToShortDateString()), New With { _
Key .[class] = "datefield", _
Key .type = "date" _
})

VB.Net匿名類型語法在屬性名稱前使用“ New With和一個點。 嘗試以下

new with { .@class = "datefield", .type = "date"  }

注:我不是100%肯定,如果.@class將與剃刀工作。 您可能需要以某種方式對其進行轉義。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM