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;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top