Dailycode.info

Short solution for short problems

Short if Structure

A quick and to many probably stupid post, but I keep forgetting the short if structure, so to save the googling everytime I need it, here it is: 

 rep.IsActive = (row["is_active"].ToString()=="1"?true:false);
 

object result = (comparisonA==comparisonB?returnObjectA(true):returnObjectB(false));

 bool bMe = (Myname=="Mark"?true:false);
 
If Myname == "Mark", then nMe is true, else it's false!