|
What .NET class can I use to query the user rights of the user currently logged in?
|
|
|
|
|
What are you trying to do with this?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
hi,
I need to Convert Row Data to Column Data in a Data table.
How do I do it.?
|
|
|
|
|
can u explain more in detail what u need?
<< >>
|
|
|
|
|
Hello,
Is there any information available on how to create a simple crystal report in Windows Form? Just want to see how I can manipulate the properties, etc...
Thank you.
|
|
|
|
|
hi there,
I'm pretty sure that there are a a lot of articles about this on CP site.
try to search....
below is just one of them
http://www.codeproject.com/csharp/leTaonarticle2.asp
<< >>
|
|
|
|
|
The article describes it for ASP.NET, I need the window app, and I can't find anything useful.
|
|
|
|
|
To use ReportDocument object, what System directives I have to load?
Thank you.
|
|
|
|
|
Hello, guys
I found an interesting topic on MS newsgroup. And I'd like to ask you a simple question. What is the value of "i " variable after the code ?
int i = 5;
i = i++;
???
Provide me, please, with an answer you though/expected just after you looked at the code. And then, any ideas why does C# compiler work so ? (if you will run the code, you will understand what I mean).
With best regards,
Andrew
|
|
|
|
|
The value of i will be 5 because the i++ increments the value AFTER the assignment.
If you want i to be 6 then you can do it like this:
<br />
int i = 5;<br />
i = ++i;<br />
The method above increments the value BEFORE the assignment.
By the way, this is not just a C# thing, any C syntax language shoould behave this way (incl. java, javascript, C++ etc..)
Si
|
|
|
|
|
Anonymous wrote:
By the way, this is not just a C# thing, any C syntax language shoould behave this way (incl. java, javascript, C++ etc..)
Yes, maybe other languages also should, but C++ produces 6. (managed and unmanaged versions).
With best regards,
Andrew
|
|
|
|
|
I guess "5"
It's actually the same with C(++), because the expression i++ is evaluated AFTER the statement.
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Greeeg wrote:
It's actually the same with C(++),
Not the same. I've checked on my VS 2003.
With best regards,
Andrew
|
|
|
|
|
Problem is there in your example. Try to use different variable to distingush the difference.
int i=5,j=0;<br />
j=i++;
Sreejith Nair
[ My Articles ]
|
|
|
|
|
Sreejith SS Nair wrote:
Problem is there in your example.
I know that my example is useless. It was interesting another thing: C(++) gives 6, but C# gives 5.
Never mind, the C# behavior is good described in MSDN[^].
With best regards,
Andrew
|
|
|
|
|
You wrote : Provide me, any ideas why does C# compiler work so ?
I post answer for your queary. And sorry if you twist the issue.
Sreejith Nair
[ My Articles ]
|
|
|
|
|
|
Andrew Kirillov wrote:
int i = 5;
i = i++;
Easy, 5. The value of i is incremented after the expression is evaluated.
In this example:
Andrew Kirillov wrote:
int i = 5;
i = ++i;
Here, i will be 6. The value of i is incremented before the expression is evaluated.
This is all defined functionality in the C# language specification. C and C++ do the same thing.
7.5.9 Postfix increment and decrement operators[^]
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Dave Kreskowiak wrote:
C and C++ do the same thing.
No ! I wrote it alredy. I've tested it with VS.NET 2003. C++ (managed and unmanaged) gives 6.
With best regards,
Andrew
|
|
|
|
|
Andrew Kirillov wrote:
No ! I wrote it alredy. I've tested it with VS.NET 2003. C++ (managed and unmanaged) gives 6.
Then I'd say the problem is with C++ not with C#.
Try this:
<br />
int i = 5;<br />
if (i++ == 5)<br />
{<br />
Console::WriteLine("Five");<br />
}<br />
else<br />
{<br />
Console::WriteLine("Six");<br />
}<br />
In C# and C++ you should get "Five" as a result.
|
|
|
|
|
Wjousts wrote:
Try this:
....
In C# and C++ you should get "Five" as a result.
Yes, I know. It will be the same in both languages. I was interested in original code I wrote.
With best regards,
Andrew
|
|
|
|
|
Actually you are right, it should be 6 (in your original code) in both C++ and C#. Nasty trick question that. So it would appear to be a problem with the C# compiler.
|
|
|
|
|
After doing some digging, the evaluation rules are slightly different between the C++ language specifications and the C# specs. It's not a bug as far the specifications describes the process.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
No, I think it is a bug, evaulation rules or not. It's very easy to miss (and I did at first) but the prefix/postfix thing is irrelevant:
<br />
int i = 5;<br />
i = i++;<br />
versus
<br />
int i = 5;<br />
i = ++i;<br />
Should both end up with i = 6. i++ is the same as i = i + 1 (so is ++i) so really the both code snippets should become
<br />
int i = 5;<br />
i = i;<br />
i = i + 1;<br />
and
<br />
int i = 5;<br />
i = i + 1;<br />
i = i;<br />
It shouldn't matter if you do i = i first or i = i + 1 first the result should still be six.
As somebody else pointed out, it you do j = i++ then look at the value of j then the prefix/postfix part matters, but because you are putting the result back in to i it should be six either way.
|
|
|
|
|
According the doc's I read in the specifications, the result your seeing is the expected result of the expression.
C# in 2002, 2003, and 2005 do the exact same thing. The specifications between versions didn't change.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|