Browsing 7239 questions and answers with Jon Skeet
Well, in terms of efficiency that's creating a lot of extra objects for the sake of transparent identifiers in the translation from query expressions to SelectMany calls. You could convert it to: var fooDs = ListFooA.SelectMany(a =>... more 2/25/2014 11:46:18 AM
No. List<T> is explicitly documented not to be thread-safe: It is safe to perform multiple read operations on a List, but issues can occur if the collection is modified while it’s being read. To ensure thread safety, lock the... more 2/25/2014 10:41:31 AM
Firstly, calling Thread.Sleep like this is not a good way of getting a different seed. It would be better to use a single instance of Random per thread. See my article on randomness for some suggested approaches. However, your code is... more 2/25/2014 10:37:09 AM
First, let's separate this into three separate cases which can't interact: int i = 1; System.out.println(i+ + +i); // 2 int j = 1; System.out.println(j++ +j); // 3 int k = 1; System.out.println(k+++k); // 3 Now let's rewrite them... more 2/25/2014 9:43:21 AM
Two problems: Firstly, your SQL is specifying literal values because of the quotes. It should be: INSERT INTO Profiles (ProfileName, ProfilePath, ProfileDescription) VALUES (@name, @path, @desc) That way the SQL refers to the... more 2/25/2014 9:01:27 AM
I suspect you just need to reverse your where and group by clauses. Filter first, then group: var result = from contact in contacts where contact.DateOfBirth.Year > 1970 || contact.DateOfBirth.Year <... more 2/25/2014 8:12:49 AM
I will have the offset for each user That's broken to start with. You can't have an offset for each user, because offsets change over time - and they don't all change at the same time. Your current code assumes that all users will... more 2/25/2014 8:05:51 AM
This is the problem: ArrayList<BigInteger> a=new ArrayList<BigInteger>(); ArrayList<BigInteger> b=new ArrayList<BigInteger>(); for(int j=0;j<2;j++){ // Stuff } You're reusing the same lists for each test... more 2/25/2014 7:53:28 AM
I thought its access modifier is public, but when I deal with a inner class issue, I found maybe I was wrong. Yup. Indeed, I found myself in the same situation a couple of years ago. I was surprised by an error (through Guice... more 2/25/2014 7:16:26 AM
Any time you find yourself reaching for Application.DoEvents, you should try to reconsider - it's generally a workaround. At least this time you already know you're in a bad situation :) If you're happy to do everything synchronously, I... more 2/25/2014 7:04:20 AM