471,317 Members | 1,789 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,317 software developers and data experts.

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

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
Dec 12 '05 #1
3 1009
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
"Steven C." wrote:
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

Dec 12 '05 #2
The equivalent code in longhand:

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

Dec 12 '05 #3
Thanks!
This helps. C# definitely aint Foxpro!

Thanks again;
Steven
On 12 Dec 2005 15:23:39 -0800, "Bruce Wood" <br*******@canada.com> wrote: The equivalent code in longhand:

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


Dec 13 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Alex Vinokur | last post: by
1 post views Thread by bluekite2000 | last post: by
2 posts views Thread by David W. Deley | last post: by
3 posts views Thread by kaleshwar | last post: by
1 post views Thread by howa | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.