C# 在VB中为每个标记编写代码

C# 在VB中为每个标记编写代码,c#,vb.net,C#,Vb.net,我知道我可以将此代码放在标记中,为C#标记创建一个转发器,但是我可以在VB.net中执行类似的操作吗 <% foreach (var c in Contacts) { %> <div class="footer"> <% if (c.Custody != null) { %> <label>Custody:</label> <%= c.Custody.Name %><br /> &

我知道我可以将此代码放在标记中,为C#标记创建一个转发器,但是我可以在VB.net中执行类似的操作吗

<% foreach (var c in Contacts) { %>
<div class="footer">
    <% if (c.Custody != null) { %>
        <label>Custody:</label> <%= c.Custody.Name %><br />
    <% } %>
</div>
<% } %>

监护权:

监护权:

这应该能奏效!快乐编码

如果你对它满意,请将此标记为正确答案。
<% For Each itm In tContacts %>
 <div class="footer">
    <% If itm.Custody IsNot Nothing Then %>
        <label>Custody:</label> <%= itm.Custody.Name %><br/>
    <% End If %>
 </div>
<% Next %>