Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
private void CheckInput(int input, string methodName) {
if (input != 42) {
throw new ArgumentOutOfRangeException(nameof(input), $"{methodName} cannot be invoked with a non-42 value");
}
}
public void DoFoo(int input) {
CheckInput(input, "DoFoo");
// ...
}
public void DoBar(int input) {
CheckInput(input, "DoBar");
// ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.