Is there a way to use a ternary operator - or similar method - for picking the variable to assign to?
问题 is it possible to differ the variable I'm assigning to depending on a condition? The issue I came across is wanting to do this: (bEquipAsSecondary ? currentWeaponOffhand : currentWeaponMainhand) = weaponToSwitchTo; Instead of if (bEquipAsSecondary) { currentWeaponOffhand = weaponToSwitchTo; } else { currentWeaponMainhand = weaponToSwitchTo; } Which results in the following error Error CS0131 The left-hand side of an assignment must be a variable, property or indexer So I was wondering if