C# Conditional statement

January 25, 2011

(1) 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);

One response to "C# Conditional statement"

alpha said:
January 14, 2012

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

Leave a comment

Name : 
Mail : 
Website : 
Message :