Browsing 7239 questions and answers with Jon Skeet
Yes, it's just a bad example. If ComputeNextMove is truly just a synchronous method which doesn't really do anything asynchronously (as the description suggests), it shouldn't be declared as async. It should instead be private void... more 2/11/2014 4:48:00 PM
Your "else" block contains the code that you want to execute after you've checked all items - not on each item. I think you want: if (items.Any(item => item.itemid == id)) { MessageBox.Show("You already giving your rating."); ... more 2/11/2014 4:35:02 PM
I would suggest: Using a sortable date format, just because that's naturally pleasant Explicitly specifying the invariant culture, to avoid oddities of ending up using a different calendar system. (I suspect you always want to use the... more 2/11/2014 4:22:24 PM
What you've described simply doesn't happen. The compiler does not create a wrapper array unless it needs to. Here's a short but complete program demonstrating this: using System; class Test { static void MyMethod(params object[]... more 2/11/2014 2:52:24 PM
Due to type erasure the .class file is purely pre-generic code and it must not be knowing whether it is generic or not No, that's not true. The information about the generic type is still present in the class file. Type erasure is... more 2/11/2014 2:24:56 PM
In C#, all properties of anonymous types behave as if they have the Key modifier in VB: the properties are read-only, and they're included in equality and hash code evaluation. In VB, properties without the Key modifier are mutable, and... more 2/11/2014 1:52:33 PM
However comment is always "Foo" (message box shows "Not Allowed"), so it appears that the ByRef modifier is not working It is, but you're using it incorrectly, with incorrect expectations :) When you create the argument array, you're... more 2/11/2014 12:04:00 PM
The problem is that you're using Matcher.matches(), which is documented as: Attempts to match the entire region against the pattern. You don't want to match the entire region - you just want to find a match within the region. I... more 2/11/2014 10:24:12 AM
Just use the overload of addAll which takes the index at which to insert the items: myList.addAll(0, newList); No need for a new method at all. more 2/11/2014 9:25:04 AM
Your List<String> isn't storing strings. It's storing string references. In each case, you've got a single String object, and then a list with a lot of references to the same object. It's like having a single house, and millions of... more 2/10/2014 10:11:54 PM