Bala's Development Blog

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

One Response 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

Leave a Reply

Your email address will not be published. Required fields are marked *