Browsing 7239 questions and answers with Jon Skeet
Unfortunately this is tricky with .NET generics. If MyClassConfiguration doesn't actually care about the type arguments, you might want to create a non-generic interface: public interface IMyClass { // Any members of MyClass<,>... more 4/14/2014 9:02:57 AM
Given that the services will at least be using different AppDomains, and quite possibly different processes, sharing the same data between all of them would be tricky. I would personally suggest that you just don't worry about it - unless... more 4/14/2014 8:31:13 AM
I suspect you're just looking for: return to.Length == from.Length && to.Zip(from, (t, f) => t.IsAssignableFrom(f)) .All(x => x); The call to Zip here just zips the first elements of both sequences with... more 4/13/2014 2:03:17 PM
There are several steps involved here, each with different numbers. Let's split the code up for each statement: double original = 128.12301; // Or 128888.12301 float floatValue = (float) original; double backToDouble = (double)... more 4/13/2014 11:42:55 AM
The point is that upcasting will always succeed, so it's safe - whereas downcasting can fail: String x = getStringFromSomewhere(); Object y = x; // This will *always* work But: Object x = getObjectFromSomewhere(); String y = (String)... more 4/13/2014 11:37:12 AM
You're only specifying an initial capacity - the HashMap will grow as it needs to anyway, copying the contents internally. It's only available as an optimization, so that if you know you'll need a large capacity, you can start off with... more 4/12/2014 10:33:02 AM
This is simply a matter of parameters being passed by value in .NET by default. You're changing the value of source to refer to a different HashSet, and that doesn't change the caller's variable at all. Assuming that Condense doesn't... more 4/12/2014 10:16:12 AM
Your JSON has escaped the backslash, which means it's the JSON representation of "backslash u 20ac". All you need to do is not escape the backslash, so that \u20ac is the JSON-escaped version of the Euro symbol: "symbol": "\u20ac" I'd... more 4/12/2014 9:58:57 AM
What is a good practise to solve such test? The problem is that you're depending on something ephemeral: the current date/time. The fix I prefer for this is to introduce the idea of a Clock as a dependency (to be handled as with any... more 4/12/2014 9:14:31 AM
If you're using argument matches, you need to use them for all arguments. So to fix your test, you can just use: verify(loginService).getUser(eq(loginName),... more 4/12/2014 8:27:21 AM