IIF in C#
I always find myself referencing my other projects for this one when I jump between languages, so decided to toss it on the web.
Both examples are in the context of ASP .Net, but syntax also applies np to Winforms
In VB:
<asp:label id="lblmessage" runat="server" visible='<%# iif(1=1,"true","false") %>' />
C# Equivalent:
<asp:label id="lblmessage" runat="server" visible='<%# 1 == 1 ? "true" : "false" %>' />
Posted on February 8, 2011, in Programming & Development and tagged .net, .net 2.0, .net 3.5, .net 4.0, c#, compare, comparison, csharp, equals, equivalent, iif, net 2. Bookmark the permalink. Leave a comment.
Leave a comment
Comments 0