private static Base IfReturnToReturn(Derived x, Derived2 y) { if (x != null) { return(x); } return(y); if (x != null) { return(x); } return(y); if (x == null) { return(y); } return(x); if (x == null) { return(y); } return(x); }
private static Base IfReturnToReturn() { Derived x = null; Derived2 y = null; if (x != null) { return(x); } return(y); if (x != null) { return(x); } return(y); if (x == null) { return(y); } return(x); if (x == null) { return(y); } return(x); }
private static Base IfElseToReturn() { Derived x = null; Derived2 y = null; if (x != null) { return(x); } else { return(y); } if (null != x) { return(x); } else { return(y); } if (x != null) { return(x); } else { return(y); } if (x == null) { return(y); } else { return(x); } if (null == x) { return(y); } else { return(x); } if (x == null) { return(y); } else { return(x); } }
private static Base IfElseToReturn(Derived x, Derived2 y) { if (x != null) { return(x); } else { return(y); } if (null != x) { return(x); } else { return(y); } if (x != null) { return(x); } else { return(y); } if (x == null) { return(y); } else { return(x); } if (null == x) { return(y); } else { return(x); } if (x == null) { return(y); } else { return(x); } }
private static void IfStatement2() { Base x = null; Derived y = null; Derived2 z = null; // a if (x == null) { // b x = y; } if (x == null) { x = z; } }
public static void IfElseToAssignment() { Derived x = null; Derived2 y = null; Base z = null; if (x != null) { z = x; } else { z = y; } if (x != null) { z = x; } else { z = y; } if (x == null) { z = y; } else { z = x; } if (x == null) { z = y; } else { z = x; } }
private static IEnumerable IfElseToYieldReturn2() { Derived x = null; Derived2 y = null; if (x != null) { yield return(x); } else { yield return(y); } if (x != null) { yield return(x); } else { yield return(y); } if (x == null) { yield return(y); } else { yield return(x); } if (x == null) { yield return(y); } else { yield return(x); } }
private static void IfStatement2() { Derived y = null; Derived2 z = null; Base x = GetValueOrDefault2(); // a if (x == null) { // b x = y; } Base x2 = GetValueOrDefault2(); if (x2 == null) { x2 = z; } }
private static IEnumerable IfElseToYieldReturn2(Derived x, Derived2 y) { if (x != null) { yield return(x); } else { yield return(y); } if (x != null) { yield return(x); } else { yield return(y); } if (x == null) { yield return(y); } else { yield return(x); } if (x == null) { yield return(y); } else { yield return(x); } }
private static void IfElseToAssignment(Derived x, Derived2 y, Base z) { if (x != null) { z = x; } else { z = y; } if (x != null) { z = x; } else { z = y; } if (x == null) { z = y; } else { z = x; } if (x == null) { z = y; } else { z = x; } }