Bala's Development Blog

.Net,SQL Server, ASP.Net ……

C# Conditional statement

with one comment

A neat syntax in C#

isTrue ? thenDoThis : ElseDoThis

bool isBodyHTML=onFileReceived.Attributes["isBodyHTML"].Equals("true")?true:false

Another example of use

StringBuilder sb = new StringBuilder();
sb.AppendLine("Inner Exception " + ex.InnerException==null?"null":ex.InnerException.Message);

Written by BALA SINGAM

January 25th, 2011 at 1:50 am

One Response to 'C# Conditional statement'

Subscribe to comments with RSS or TrackBack to 'C# Conditional statement'.

  1. hello sir
    i am alpha
    i want simple c book and
    i want strong seo backlink code
    thank u sir


    14 Jan 12 at 3:25 am

Leave a Reply