문자열에 대해 C#에 OR 피연산자가 있습니까?OR 연산자 C#에서 문자열 용
나는 Microsoft C# 피연산자 페이지를보고 있으며, 문자열에 대한 어떠한 종류의 OR도 없습니다. , 일을
CS0019: Operator '||' cannot be applied to operands of type 'bool' and 'string'
내가 파이썬과 PHP를 사용하고있다 : C#을이 오류에 질식
if (Convert.ToString(r["first_name"]) != "Antoine" || "Brad" || "Programming" || "Admin" || "Patricia")
{
가 :
는 내가 쓰기를 시도하고 if 문있어 이것과 비슷한 것이 허용됩니다.
C#의 올바른 구문은 무엇입니까?
어쩌면 http://stackoverflow.com/questions/4987873/how-to-find-if-a-string-contains-any-items-of-an-list-of-strings 도움이 될 것입니다. – quip
@AndrewAlexander Operators aren boolean 표현식을 위해 형식을 위해 설계된 것은 아닙니다. –
@ MatíasFidemraizer 글쎄, 불리언 연산자에 대해서는 사실입니다. – Servy