Browsing 7239 questions and answers with Jon Skeet
Ultimately, this is using Object.clone() to create the object - and that's guaranteed to create a new object of the same execution-time type as the object it's called on: The method clone for class Object performs a specific cloning... more 9/27/2013 9:27:15 AM
Am I guaranteed to have these values retrieved as such: "z1", "abc9", "abc8", "ABC1"? Absolutely not. Always treat Dictionary<,> as an unordered collection of key/value pairs. Even though as an implementation detail you'll... more 9/26/2013 9:05:22 PM
Sure, you can do: Thread.CurrentThread.Abort(); Arguably aborting the current thread is the only kind of abort that's safe, as it's the only thread you really know about in terms of what it's doing. This is what HttpResponse.End does,... more 9/26/2013 7:50:10 PM
No, there's only one variable - you haven't declared any instance variables. Unfortunately, Java lets you access static members as if you were accessing it via a reference of the relevant type. It's a design flaw IMO, and some IDEs (e.g.... more 9/26/2013 6:31:41 PM
maybe "row" can be behavior like a shared variable rather than Yes, the row variable is captured - so whenever it's read, it's the latest value that's read. You should put the variable declaration inside the loop: while... more 9/26/2013 6:19:40 PM
If you mean "can I change the value of a to refer to a different object, simply by changing the value of b?" then the answer is no. It's important to understand that the value of a variable is never an object - always either a value type... more 9/26/2013 6:12:30 PM
If you're just talking about terminology, literal is a value specified directly in source, such as: 10 10M 100L "this is a regular string literal" @"this is a verbatim string literal" '\u000' '\n' 'X' A numeric... more 9/26/2013 4:00:33 PM
You've got the null-coalescing operator in the wrong place - currently you're calling Where on payment.NewInvoiceModels unconditionally and then checking whether the result will be null... it never will be (Where simply doesn't return... more 9/26/2013 1:38:43 PM
What is the best practice in this situation? Just suck it up, bearing in mind that tests are meant to serve you, not the other way round. Will your tests break if something goes horribly wrong? Yes. Will it be clear where the... more 9/26/2013 12:44:27 PM
I guess I could just take the absolute value, but the fact that it returns a negative value, makes me doubt if the calculations are correct. Why? nextDay is earlier than previousDay, so of course subtracting previousDay will give a... more 9/26/2013 12:38:46 PM