Browsing 7239 questions and answers with Jon Skeet
That's not what the conditional operator is for... it's not to execute one statement or another, it's to evaluate one expression or another, and make that the result of the expression. You should write your code as: if (!a) { ... more 11/11/2015 9:13:29 PM
It's because you're using it with a SELECT SQL command. From the documentation for SqlCommand.ExecuteNonQuery (emphasis mine): For UPDATE, INSERT, and DELETE statements, the return value is the number of rows affected by the command.... more 11/11/2015 8:30:47 PM
During the very first test, there's one implementation of Counter. The JIT compiler is able to assume that anything calling measure(Counter) is using the same implementation, so it can inline the code from inc(). In the second test, we... more 11/11/2015 8:13:43 PM
Nope, it's showing you the source of the constructor is being called by this(weeklySalary * numberOfWeeks)... and that's the single-parameter constructor which just assigns to the salary variable. Think of the code as being like this: //... more 11/11/2015 5:50:49 PM
I suggest you build your own class or struct that just has the pair of them - or use Tuple<LocalDate, DateTimeZone>. There's nothing specific for this in Noda Time at the moment, and I don't expect to add it unless we hear this as a... more 11/11/2015 11:20:12 AM
Rather than using async here, you can just make GetStuff a normal synchronous method and use Task.Run to create new tasks (which will normally be run on multiple threads) so that your fetches occur in parallel. You could also consider... more 11/11/2015 8:44:48 AM
I haven't used NInject myself for a while, but I believe you want to use ToConstant() to bind to the instance of SystemClock: container.Bind<IClock>().ToConstant(SystemClock.Instance); more 11/11/2015 6:57:10 AM
I suspect R# is complaining because it doesn't know that policy.ProviderID will return the same value on both evaluations. Consider: private readonly int? providerId; public int? EvilProviderId => DateTime.UtcNow.Second == 0 ? null :... more 11/10/2015 11:39:12 AM
It sounds like you need to make the Foo method generic: void Foo<T>(IB<T> param) where T : IA At that point, Foo(new G()) would be implicitly Foo<E>(new G()). more 11/10/2015 9:48:27 AM
You're using a different IV every time you encrypt - therefore you'll get different ciphertext each time you encrypt, too. Your results byte array is different each time, therefore the base64 representation is different. If you really... more 11/10/2015 7:19:46 AM