Browsing 7239 questions and answers with Jon Skeet
I suspect that it's just a matter of MemberInfo.Equals not working as you expect. That's easy to test: var m1 = get("x"); var m2 = get("x"); Console.WriteLine(m1.Equals(m2)); If that prints False, then that's the issue, and you should... more 7/8/2014 1:05:12 PM
There is no collection being built up. The sequence that is returned is evaluated lazily, and unless the caller explicitly copies the data to another collection, it will be gone as soon as it's been fetched. If you want to ensure... more 7/8/2014 11:57:00 AM
No - the result of calling the method is a RuntimeException, and that's what you're testing. How is JUnit meant to tell the difference between a RuntimeException from the exact method you're calling, and one from a dependent call? One of... more 7/8/2014 11:02:40 AM
I'm trying to switch from Linq to lambda expression. It's not clear what you mean by that, but the lambda form is still using LINQ - if you mean you had a query expression before, it's worth being aware that query expressions are just... more 7/8/2014 10:41:26 AM
You can return an unmodifiable view of it, changing the return type to List<String> instead of ArrayList<String>: public List<String> getCars() { return Collections.unmodifiableList(carList); } Note that as... more 7/8/2014 8:55:53 AM
You basically can't determine it reliably based on a hash code. You can check that a value definitely isn't in the set, but even if you find a matching hash code that doesn't mean that the value is in the set. This is rarely useful, which... more 7/8/2014 7:22:18 AM
It's hard to know exactly what you need based on the somewhat vague requirements, but here's some code which will get you a Dictionary<string, JToken> of the preferences: JArray preferences =... more 7/8/2014 6:23:24 AM
Just change your Devices class to use a Dictionary<,> instead of an array: public class Devices { public Dictionary<string, TstatDetails> thermostats { get; set; } } JSON.NET will interpret each property of the... more 7/8/2014 6:14:53 AM
That looks correct to me... you've got just under two months, so 60.5 days (because it starts at ~8pm and ends at ~8am). A day contains 1440 minutes. 1440 * 60.5 is 87120, which is very close to the answer you've received. It's not clear... more 7/7/2014 8:56:15 PM
You're encrypting, but then saving the result as a JPEG. That's a lossy format - after loading it again, you'll end up with an image which is visually similar to the original, but may well have some different pixels... which means it won't... more 7/7/2014 7:59:09 PM