what does this code means?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

int startOffset = (totalEmployees > 0) ?
(empGrid.CurrentPageIndex*empGrid.PageSize+1) : 0;

I can't find any reference to the ? syntax

any web reference would be appreciate..

many thanks
 
It is the ternary operator. It is the same as writing:

int startOffset;
if (totalEmployees > 0)
startOffset = empGrid.CurrentPageIndex*empGrid.PageSize+1;
else
startOffset = 0;
 
Back
Top