Browsing 7239 questions and answers with Jon Skeet
It looks like you want: PlacedSelection actualSelection = Model.Coupon.Categories .SelectMany(cat => cat.Value.Selections) .FirstOrDefault(selection => selection.EventId == Model.EventId); Any would be used if you were... more 10/3/2014 9:51:54 AM
Just specify explicit numeric values for the entries: public enum StringID { String_EMPTY = 0, String_Inventory = 1, String_Recipes = 2, String_Tools = 3, String_Journal = 4, //... } That way the ordering is... more 10/3/2014 9:25:41 AM
When an exception occurs in an async method, it doesn't just propagate up the stack like it does in synchronous code. Heck, the logical stack is likely not to be there any more. Instead, the exception is stored in the task which... more 10/3/2014 6:03:23 AM
There are two benefits in extracting the constant into a static final field: Firstly, it has a name - admittedly SIZE isn't a very good one (size of what? why?) but in other cases it can be very useful to make your intent clear. For... more 10/3/2014 5:51:21 AM
You've got the lambda expression in the wrong place - the whole of the argument to filter should be the lambda expression. In other words, "Given a player p, should I filter it or not?" players.stream().filter(p ->... more 10/2/2014 9:56:30 PM
Well, it's an implementation detail - but I wouldn't expect it to be a linked list of characters. I'd expect it to be a char[] with a length, basically - like an ArrayList, but for characters. So inserting a character at the start of the... more 10/2/2014 9:51:53 PM
It sounds like you should probably just filter out time zone IDs which don't have a / in. TZDB contains zone IDs such as EET and EST - for example, version 2014a contains the follow IDs of 4 characters or fewer: "CET", "Cuba", "EET",... more 10/2/2014 9:33:36 PM
This answer assumes you can't change the requirements. If you can use a hi/lo scheme to generate unique IDs which aren't random, that would be better. I assume you've already set this as a primary key in the database. Given that you've... more 10/2/2014 9:09:27 PM
It looks like the C# compiler removes the call to that method No, it doesn't - this is just how iterator blocks work. The code inside the iterator block will only start being executed when MoveNext() is called for the first time. If... more 10/2/2014 12:37:33 PM
It's not really clear whether you're concerned about the amount of code you've written, or the efficiency of it. From an efficiency perspective, it's fine - it's O(N), but that's hard to avoid if you're populating a dictionary with N... more 10/2/2014 12:18:08 PM