That seems like a nasty bug in Visual Studio debug mode which is fooling you: Now F10 to step over this line and you get: On the console correct values are printed WTF.
That seems like a nasty bug in Visual Studio debug mode which is fooling you: Now F10 to step over this line and you get: On the console correct values are printed. WTF.
– Darin Dimitrov Aug 29 '10 at 12:21 1 @JeremySpouken: That’s equivalent to Rectangle?. – Timwi Aug 29 '10 at 12:33 Interesting. I typed the same code into VS and I get the correct values (in both DEBUG and RELEASE mode)... – Timwi Aug 29 '10 at 12:38 @Timwi, what is the exact version number of VS you are using and the OS?
For me it's 10.0.30319.1 RTMRel running on Windows 7 x64. – Darin Dimitrov Aug 29 '10 at 12:40.
Rectangle cropArea = (!inputArea. HasValue)? Rectangle : inputArea.Value.
1 That’s equivalent. – Timwi Aug 29 '10 at 12:05 Now why the spam on my thread fellas :) @ InputArea = null; Nullable inputArea2 = null; @TimWi - now why the downvote .. was just trying to help the OP out? – nonnb Aug 29 '10 at 12:47 +1 because I made a mistake on your post and started a small flame war.
Turns out it is only the Silverlight Rectange class that is not nullable. – Tech Magic Aug 29 '10 at 14:35.
I just tried running that and it works fine. Make sure that image has a size and that inputArea is actually null.
Yes, all of which had seemed very weird, until I realized visual studio lied to me. See my edit. – Max Aug 29 '10 at 12:12 @Max: Maybe it was a good thing I didn't use VS, then.
– Matti Virkkunen Aug 29 '10 at 12:16.
Your code appears correct. The conditional expression (or conditional operator, or originally called the ternary operator... everyone happy now? :)) should be interchangeable with if/else statements.
Rectangle cropArea = inputArea == null? Rectangle : inputArea. Value; should be exactly the same as: Rectangle cropArea; if (inputArea == null) { cropArea = rectangle; } else { cropArea = inputArea.
Value; } (in fact they should generate the same IL code). Trace through with the debugger and see if anything jumps out at you.
Please don’t call the conditional operator “the ternary operatorâ€?. I’ve edited your answer to correct this, I hope you don’t mind. – Timwi Aug 29 '10 at 12:11.
Rectangle rectangle = ...; Rectangle cropArea; if (inputArea == null) cropArea = rectangle; else cropArea = inputArea. Value; if (inputArea == null) cropArea = rectangle; Why have the second if? It's totally and entirely redundant.
The scenario in which cropArea might still be null or zero is if inputArea. Value is null/zero, since you didn't check for that (only if inputArea is null).
My question is not about how to solve this error(I already solved it) but why is this error with boolean value. Error is Use of unassigned local variable 'str'. Bool can only take true or false.
So it will populate str in either case. Then why this error? Moreover this error is gone if along with true and false case I add a default case, but still what can a bool hold apart from true and false?
Why this strange behaviour with bool variable?
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.