我試圖做的,如果(SOMETHING & & NOT)OR(SOMETHING & & NOT)...但它不工作,你可以看到我做了什麼錯?什麼是IF的語法和或C#
if (MyBeam.Position.Rotation == Position.RotationEnum.FRONT &&
!(MyBeam.Profile.ProfileString.Contains("RHS")
|| MyBeam.Profile.ProfileString.Contains("CHS")
|| MyBeam.Profile.ProfileString.Contains("MET")
|| MyBeam.Profile.ProfileString.Contains("SHS")
||
(MyBeam.Position.Rotation == Position.RotationEnum.BACK &&
!(MyBeam.Profile.ProfileString.Contains("RHS")
|| MyBeam.Profile.ProfileString.Contains("CHS")
|| MyBeam.Profile.ProfileString.Contains("MET")
|| MyBeam.Profile.ProfileString.Contains("SHS")))))
忽略對API的引用,但我相信它仍然有意義。
哪一部分無法爲你工作? – Biscuits
結合起來嗎? if((MyBeam.Position.Rotation == Position.RotationEnum.FRONT || MyBeam.Position.Rotation == Position.RotationEnum.BACK)...' – Ric
只需簡單的包含位,就可以使用數組'myArray.Any(MyBeam.Profile.ProfileString.Contains)',其中'myArray'是一個「RHS」,「CHS」的數組......' – Matthew