What could be the shortest way of checking function parameter , which might have values 0 , 1 , 2 , 3 in C# -


मेरे पास C # में एक फ़ंक्शन है जो ऐसा दिखता है:

  सार्वजनिक स्थिर शून्य OnlyValidInput (int ParameterName) {if (parameterName == 0 || पैरामीटरनाम == 1} parameterName == 2 ...) {... do ok stuff} else {नया CustomException ("अमान्य परम होना चाहिए 0, 1, 2" ); }}  

इसे कम कैसे करें ...

धन्यवाद सब, जवाब से पता चला कि मैं किस बारे में सोच रहा था, लेकिन इसका वर्णन नहीं कर सका ...

  यदि (पैरामीटरनाम> = 0 & amp; amp; पैरामीटरनाम & lt; = 3) < / Code> 

यदि आप इसे निरंतर होने की उम्मीद करते हैं।


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -