question mark inside C# syntax [duplicate]

The conditional operator (?:) returns one of two values depending on the value of a Boolean expression. Following is the syntax for the conditional operator.

condition ? first_expression : second_expression;

C# reference: http://msdn.microsoft.com/en-us/library/ty67wk28.aspx

In your case currFrame will be assigned a value of 255 if ( diff >= differenceThreshold ) || ( diff <= differenceThresholdNeg ) is true, otherwise value 0 will be assigned.

Leave a Comment