C# Conditional statement

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

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

Leave a Comment

NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>