>>>>Any way to do this in C# like VFP's IIF()?
>>>>
>>>>
>>>>if (Checked)
>>>>{
>>>> _CheckItemsCount++;
>>>>}
>>>>else
>>>>{
>>>> _CheckItemsCount--;
>>>>}
>>>>
>>>
>>>
_CheckedItemsCount+= (Checked) ? 1:-1;
>>
>>IMHO, this is harder to read than the original.
>
>Probably because you're not used to reading it :-}
For sure it's in the eyes - and experience - of the beholder.
The C/C++/C# conditional operator is so useful I'd bet it's widely implemented in other languages, too. But so is IF... etc.
It could be argued that for simple cases like this the *only* significant consideration is readability/maintainability. Any decent optimizing compiler (JIT or otherwise) will probably spit out identical opcode for those two snippets.
Regards. Al
"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov
Neither a despot, nor a doormat, be
Every app wants to be a database app when it grows up