Browsing 7239 questions and answers with Jon Skeet
An array access expression is classified as a variable. You can assign to it, pass it by reference etc. An indexer access is classified separately... in the list of classifications (C# 5 spec section 7.1.) An indexer access. Every... more 8/3/2015 3:10:32 PM
Firstly, it's not a lambda expression - it's just that expression-bodied members (introduced in C# 6) also use the syntax of =>. They don't involve creating a delegate instance or an expression tree though. As for why return isn't... more 8/3/2015 10:50:59 AM
Yes, WaitForChanged is a synchronous method: This method waits indefinitely until the first change occurs and then returns. You're calling that from the UI thread - therefore blocking any other UI thread interaction in the meantime.... more 8/3/2015 9:07:38 AM
It sounds like you just need to fetch the counts first (you may want to cache them): var counts = db.Counts.ToDictionary<string, int>(c => c.Name, c => c.Count); Then: var postsInGallery = postInWidgets .Where(wid =>... more 8/3/2015 8:59:33 AM
You should use the Json.NET attribute support to customize the naming: public class Customer { [JsonProperty("firstName")] public string FirstName { get; set; } } more 8/3/2015 8:49:15 AM
The truth is somewhere between the two: The object can't be garbage collected, so the possibility of the object no longer "being there" isn't true An object can be finalized when there are no longer any references to it from other... more 8/3/2015 7:18:33 AM
No, you won't have created a memory leak. Calling Clear or Dequeue will clear the memory appropriately - for example, if you had a List<T> then a clear operation might use: for (int i = 0; i < capacity; i++) { array[i] =... more 8/2/2015 6:42:53 AM
I'd use LINQ to XML for this. My first somewhat inefficient way of doing this would be: foreach (var element in doc.Descendants()) { int indexInLevel = element.ElementsBeforeSelf().Count() + 1; var parent = element.Parent; ... more 7/31/2015 5:05:10 PM
It's still there, just moved to be its own dockable window instead of a dialog: Debug => Windows => Exception Settings more 7/31/2015 3:25:03 PM
It's not possible to do this in normal C# (i.e. calling a method or property in a normal way), regardless of whether the method is virtual or not. For non-virtual methods, you can create a delegate from an open instance method,... more 7/31/2015 1:58:45 PM