How to assign the NULL value in the immediate if statement

Nov 8 2018 2:33 AM
 
11/8/2018  
  1. byte? SeverityId = null;  
  2. SeverityId = arr["SeverityId"].ToString()==""null: Convert.ToByte(arr["SeverityId"].ToString());  
Able to do like this
 
  1. if(arr["SeverityId"].ToString()==""  )  
  2. {  
  3.   SeverityId = null;  
  4. }  
  5. else  
  6. {  
  7. SeverityId= Convert.ToByte(arr["SeverityId"].ToString());  
  8. }  
 But I need in One line.
 
 

Answers (1)