Browsing 7239 questions and answers with Jon Skeet
Okay, given the "tax rate of an empty string should be treated as 0", I would probably break that up into a separate method. It's simpler than trying to do it inline. Then I'd use explicit conversions everywhere. So something... more 2/5/2014 8:12:04 PM
I think, this code have a doubling: if I change a method name in Points I also have to change method setX in class Curve. No you don't. You can if you want, but the two methods are independent. You don't have to expose all the methods... more 2/5/2014 7:30:10 PM
Yes, using the indexer should be absolutely fine if you want to add or replace a value. AddOrUpdate takes a delegate so that you can merge the "old" and "new" value together to form the value you want to be in the dictionary. If you don't... more 2/5/2014 6:03:14 PM
Okay, basically it looks like it's a bug in JUnitParams. After applying the fix in the original answer below, the library still "unwraps" the String[] when we don't want it to - given the amount of conditional wrapping and unwrapping going... more 2/5/2014 4:24:44 PM
That's why I have the IsNothing statements That suggests you expect the values to be IsNothing before they're given a specific value. In C#, this wouldn't just be a warning - it would be an error. I have two suggestions: If you... more 2/5/2014 1:02:59 PM
It may not be the only thing that you need to do, but I think you want to use Expression.Condition rather than Expression.IfThenElse. Currently you've got the equivalent of: if (condition) { default(...); } else { ... more 2/5/2014 10:52:23 AM
I suspect the problem is that you're setting the length based on the length of the file in bytes, whereas the parameter to setCharacterStream is meant to be a length in characters. You're also using the platform default encoding, which is... more 2/5/2014 7:56:16 AM
I doubt that it's really anything to do with call and callvirt. I strongly suspect it's simply because you're not using any fields within SomeClass.Foo. The garbage collector is free to collect an object when it is certain that none of... more 2/5/2014 7:43:53 AM
Right, with the new code it seems reasonably simple: just create the individual lists after you've sorted the list of maps: // This loop looks wrong at the moment - you're not using i for (int i = 0; i < json.Length(); i++) { ... more 2/5/2014 7:15:20 AM
It nearly sounds like you don't really want it sorted by order, primarily - you want it sorted by product ID and then order. So: SELECT * FROM Products ORDER BY ProductId, [Order] And in a LINQ query expression: var results = from... more 2/5/2014 7:05:03 AM