Is it possible to get a requirement for 2 optional parameters together? Here's an example:
public void ParamChoise(string A, bool B = false, string C = "Y")
{
// Stuff here
}
Where B is optional, I want the function to require C if B is true. From my Logic something like that:
public void ParamChoise(string A, (bool B = false, string C = "Y"))
Couldnt find anything by googling. One possible way for me would be:
/// <summary>
/// If you want behaviour XXX to be enabled, please enter "C" for usage.
/// </summary>
/// <param name="A"></param>
/// <param name="C"></param>
public void ParamChoise(string A, string C = "Y")
{
// Stuff here
}
For sure I could give my function a comment like this, but writing a comment for an unlogical given parameter feels bad to me.
This case is maybe a bad example but Im sure I'll run into this again in the future.
Thanks very much :).
EDIT TO CLEAR THINGS:
Possible combination for the parameters:
- A only
- A & (B & C)
- NOT A & B
- NOT A & C (Because B gives the point if C is needed)
Cis required before you invokeParamChoice.NOT A & B- does this meanNOTas in a boolean!or as in "I dont want"