What Is This? > bool isClickInCell = hti.Column == this._columnNum && hti.Row > -1;

S

Steven C.

I'm trying to learn C#, and I came across the following:


bool isClickInCell = hti.Column == this._columnNum && hti.Row > -1;

What exactly is going on here?

As a Foxpro dude, this totally confounds me ;)

Thanks!

Steven
 
G

Guest

It's a poorly parenthesized block that would be a bit more readable as:

bool isClickInCell = ((hti.Column == this._columnNum) && (hti.Row > -1));

or more so as an if block ala:

bool isClickInCell;
if((hti.Column == this._columnNum) && (hti.Row > -1))
{
isClickInCell = true;
}
else
{
isClickInCell = false;
}

In short... it’s determining if the desired column was hit, and having the
output of this logical operation (true or false) be returned and stored in
isClickInCell.

Is that a little more clear?

Brendan
 
B

Bruce Wood

The equivalent code in longhand:

bool isClickInCell;
if (hti.Column == this._columnNum)
{
if (hti.Row > -1)
{
isClickInCell = true;
}
else
{
isClickInCell = false;
}
}
else
{
isClickInCell = false;
}
 

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

Top