Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
ユーザーの入力を受け取り、ユーザーが入力したものの最後が何かで終わっているかどうかを確認したいと思います。しかし、それは複数の文字列です。私はそれをリストに持っています。そして、入力がリストの文字列で終わるかどうかを1つずつ確認できました。ただし、入力がリストの何かで終わっているかどうかを確認したいだけです。
"endings" が、一致する可能性のある語尾を含む List<string> の場合:
if (endings.Any(x => userInput.EndsWith(x))) { // the string ends with something in the list }