code_junkie

What is the C# equivalent of the Oracle PL/SQL COALESCE function?

Nov 10th, 2011
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. //pseudo-codeish
  2. string s = Coalesce(string1, string2, string3);
  3.  
  4. object obj = Coalesce(obj1, obj2, obj3, ...objx);
  5.  
  6. object obj = Coalesce(obj1, obj2, obj3, ...objx);
  7.  
  8. object obj = obj1 ?? obj2 ?? obj3 ?? ... objx;
  9.  
  10. var a = b ?? c;
  11.  
  12. var a = b != null ? b : c;
Add Comment
Please, Sign In to add comment