Questions tagged «in-operator»


14
有C#IN运算符吗?
在SQL中,可以使用以下语法: SELECT * FROM MY_TABLE WHERE VALUE_1 IN (1, 2, 3) C#中是否有等效项?IDE似乎将“ in”识别为关键字,但我似乎无法找到任何有关它的信息。 因此,是否可以执行以下操作: int myValue = 1; if (myValue in (1, 2, 3)) // Do something 代替 int myValue = 1; if (myValue == 1 || myValue == 2 || myValue == 3) // Do something
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.