This has me pretty stumped. Maybe I'm too tired right now.
Rectangle rectangle = new Rectangle(0, 0, image.Width, image.Height);
Rectangle cropArea = inputArea == null ? rectangle : inputArea.Value;
if (inputArea == null)
cropArea = rectangle;
inputArea is a nullable Rectangle, which in my particular case is null.
The first two statements yields a cropArea initialized to 0. The second, however, yields the correct cropArea based on the image width and height. Have I misunderstood anything with the conditional operator? It seems it does not return rectangle when inputArea = null? Is there any quirks when working with value types?
EDIT: Alright, I should have tried this first: restarted VS. It seems the debugger lied to me, or something. Anyway, works now. Thanks.