Browsing 7239 questions and answers with Jon Skeet
I don't know of any "proper" way, but one approach would be to call hashCode() in the watch window when you first create it, and then make the breakpoint conditional on the hashCode() as well. So you'd need to change the break point each... more 1/24/2015 9:58:19 PM
Is it bad practice to add a main function to every single class for tests? Yes, for various reasons: It suggests you've got a single test per class, or multiple tests within a single method. It suggests you're probably not using a... more 1/24/2015 6:58:45 PM
The right answer is to stop building your SQL like that to start with. Use parameterized SQL, then specify the DateTime value as the parameter value - you don't need a string representation at all in your code. It's not immediately clear... more 1/24/2015 6:56:35 PM
For example: I have a method that calculates a bunch of results from 2 long variables That sounds like you should encapsulate the results in a new class then, and use method parameters for the two inputs. Any time you have multiple... more 1/24/2015 11:08:33 AM
Unfortunately, you'd need to convert the set to an array - it's easy to do, but quite inefficient: Configure(activity, options, appId, zoneIdSet.toArray(new String[0])); The new String[0] could be replaced by new... more 1/24/2015 10:32:28 AM
Binary search only works when the list is already sorted. The way that binary search works is that the algorithm assumes that if the value at its "guess" index is higher than the one we're looking for, the actual index must be lower - and... more 1/23/2015 8:52:04 PM
As I suggested in comments, you could use the version of Roslyn which does know about primary constructors to parse the code into a syntax tree, then modify that syntax tree to use a "normal" constructor instead. You'd need to put all the... more 1/23/2015 4:35:09 PM
Look at the .NET Framework Targeting Pack page for issues like this. Basically, under Windows 8 you need to explicitly enable .NET 3.5 in "Windows Features". For earlier versions of Windows it just needs to be installed - the page has a... more 1/23/2015 4:03:10 PM
This is the problem: public class TestTemplate<ITrackedItem> You've declared a type parameter called ITrackedItem, which is entirely different to the ITrackedItem interface. It's not clear that your type needs to be generic at all... more 1/23/2015 11:55:24 AM
It should match the equality that will be tested for the hashed version. Basically, imagine that one of the passwords was stored, and you were trying to log in with the other - would it work? That's surely what you're trying to test. I'd... more 1/23/2015 11:34:25 AM