Using a bool as a parameter in a function/method
I have various bools: ShowSetA, ShowSetB, ShowSetC etc
I want to create a function like this, so I'm not repeating a bunch of code:
MyFunction (ref bool VarShow) {
if (
VarShow == true
)
{
//Do this
}
}
And call the function like this:
MyFunction (ref ShowSetA);
Unfortunately this doesn't work and I get the error "a non ref returning property or indexer may be used as an out or ref value".
Can you see what I'm trying to do? Just replace VarShow in the Function with ShowSetX etc...