Browsing 7239 questions and answers with Jon Skeet
I strongly suspect this has nothing to do with the version of .NET you're using. After all, from the stack trace you can clearly see that your code is executing: at MyApplication.Form1.DirectoryExporter_Click(Object sender, EventArgs... more 9/5/2014 1:35:41 PM
In fact, the lookup based on a List<Button> will be faster than based on a string, because List<T> doesn't override Equals. Your keys will just be compared by reference effectively - which is blazingly cheap. Compare that with... more 9/5/2014 12:46:27 PM
You can't at the moment. You will be able to in C# 6: List<string> Countries { get; set; } = new List<string>(); You can even make it a read-only property in C# 6 (hooray!): List<string> Countries { get; } = new... more 9/5/2014 12:36:01 PM
Well you can do it with a conditional operator, but you need to specify the type of the expression tree for each lambda expression: var expression = condition == null ? (Expression<Func<Person, bool>>) a =>... more 9/5/2014 12:34:50 PM
Is there any way correct this behavior? It's already the correct behaviour according to the C# language specification. The overload of Func called within FuncWrap is normally determined at compile time, so it can't pick a different... more 9/5/2014 12:05:25 PM
You can provide an initial capacity in the HashMap constructor: Map<String> map = new HashMap<>(1); It looks like that is genuinely obeyed in the implementation I'm looking at, but I can easily imagine some implementations... more 9/5/2014 10:51:18 AM
A few possible problems: It's not clear why you're explicitly setting a parameter to null. Why not just specify the column names explicitly in the SQL (which will make it clearer) and omit that column/parameter? Although you're creating... more 9/5/2014 6:39:05 AM
So is my above query still relevant? Yes. When you compare two DateTimeOffset values, it's the "absolute" time that is compared. The documentation talks about this in terms of the UtcDateTime property. For example, from the... more 9/4/2014 7:00:52 PM
I assume that I need to convert the UInt16 into an instance of the Fields enum but I'm not sure how to do that. That's easy - you need to cast to the underlying type of the enum, and then you can cast to the enum itself: Fields value... more 9/4/2014 6:55:48 PM
Based on the Language Feature Status Page it looks like you want: var singleElement2 = myClass2?.ArrayOfStrings?[0]; The example on the page is: customer?.Orders?[5]?.$price ... admittedly the $price part has been withdrawn now, I... more 9/4/2014 4:50:41 PM