booling enum arguments
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public enum MyEnum { alpha, beta, gamma } | |
public void MyOuterFunction(bool a, bool b, bool c) | |
{ | |
MyEnum asdf = MyEnum.alpha; | |
if(a) asdf &= ~MyEnum.alpha; | |
if(b) asdf |= MyEnum.beta; | |
if(c) asdf |= MyEnum.gamma; | |
MyFunction(asdf); | |
} | |
public void MyFunction(MyEnum e) | |
{ | |
//stuff | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public enum MyEnum { alpha, beta, gamma } | |
public void MyOuterFunction(bool a, bool b, bool c) | |
{ | |
MyFunction( | |
alpha | //this line only if a == true | |
beta | //this line only if b == true | |
gamma); | |
} | |
public void MyFunction(MyEnum e) | |
{ | |
//stuff | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment