Setting Window.Icon Property Value From Codebehind
posted by kentcb(140) 5 years, 3 months ago 0
Blog comments are disabled so I'll comment here. You can also just use: Icon = BitmapFrame.Create(new Uri("pack://application:,,,/App.ico")); Kent Boogaart
Reply
Speed Test: Switch vs If-Else-If
posted by kentcb(140) 5 years, 1 month ago 0
Interesting result, but I'm baffled by the closing statement: This is due to the compiler's ability to optimise the switch statement. In the case of the if-else-if ladder, the code must process each if statement in the order determined by the programmer. However, because each case within a switch statement does not rely on earlier cases, the compiler is able to re-order the testing in such a way as to provide the fastest execution. Does that mean re-ordering the if/else statements would allow the same performance to be on par with the switch statement? And how could the compiler possibly know the best order for the switch cases when the input is random? At a guess, I'd say using switch is faster because it results in less assembly instructions running, not because of the order of the tests. Wish I had the time to look into it further . . .
C# Collections
posted by kentcb(140) 5 years ago 0
Very comprehensive article (so much so that I haven't finished reading). One minor thing I found: the example in the SyncRoot section locks the collection instance instead of the collection's SyncRoot. Thus if another thread is locking SyncRoot and not the collection instance, no synchronization will occur.
Intuipic : WPF image viewer with source
posted by kentcb(140) 4 years, 11 months ago 0
So by "nothing special" you mean "simple but effective"? :) Oh, and I've never even run Vista so it's good to know that it came out so similar. I'll be looking at the exception you got sometime soon. Thanks for the, um, constructive criticism.