How to write Multiple Conditions by If and use to Assign to a variable without using 2 if else


I need to check whether 2 variables one by one whether it is empty or not and assign to another variable.

Example: Variable A = “123”
Variable B = “456”

For Variable C= IF A is not empty, assign A but if A is empty or Null , check B and if B is not empty B value else assign empty value to C


How about the following?

C = if(String.IsNullOrEmpty(A),if(String.IsNullOrEmpty(B),"",B),A)



1 Like

Another approach:

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.