Geeks With Blogs
Changhong's Technical Blog
In my previous post, I discussed how return statement is executed in try-finally clause. So in following program: string str = "original string"; try { return str; } finally { str = "changed in finally"; } the original value will be returned instead of the value changed in finally block. Would this feature be useful anywhere? Well, I can’t find anything ......

Normal 0 false false false EN-US ZH-CN X-NONE MicrosoftInternetExplorer4 /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-qformat:yes; mso-style-parent:""; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin-top:0cm; ......

So what is the output for following program? public class SimpleTest { public static void Main(string[] args) { Console.WriteLine(GetString... Console.ReadLine(); } private static string GetString() { string str = "original string"; try { return str; } finally { str = "changed in finally"; } } } It looks very simple, but most of my developer friends ......

Some interesting books are going to be released later this year and can be pre-ordered from Amazon now. Concurrent Programming on Windows by Joe Duffy Nov 2008 Framework Design Guidelines: Conventions, Idioms, and Patterns for Reusable .NET Libraries (2nd Edition) by Krzysztof Cwalina and Brad Abrams Nov 2008 Windows® Internals: Including Windows Server ......

Normal 0 false false false MicrosoftInternetExplorer4 /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin:0cm; mso-para-margin-bottom:.000... mso-pagination:widow-orphan; font-size:10.0pt; ......

A few months ago, I came cross this problem that I had 2 databases in my project, so that my model classes might map to tables from different databases. It took me a while to work out how to deal with it in ActiveRecord. Today, I had a same problem again, even though I still got my last project’s source code, it still took me a couple of hours to get ......

I was writing some WPF testing code today. It was extremely simple code which just programmatically creates a Rectangle and adds it to a canvas. The code this something like this: Rectangle rectangle = new Rectangle { Fill = new SolidColorBrush(Colors.Blue), Stroke = new SolidColorBrush(Colors.Blue), Width = 150, Height = 120 }; rectangle.SetValue(Canvas.L... ......

Recently, I have been working on maintaining two “legacy” systems. One is in VB6, implemented by a person who was not a programmer, but only trained a few weeks for VB6. The code quality is extremely poor. There are even no indentations in the code, and all variables are not properly named, for example, if there are 5 text boxes on a form, they will ......

If you use resharper with Visual Studio 2008, you may have noticed that it keeps suggesting you use implicitly typed local variable declaration i.e. the var keyword. To me, it is a bit annoying. You can actually find why people think it should exist in the first place:http://resharper.blog... There ......

I had this problem today. It looks very simple, but actually took me a while to find a solution. The problem is: I have a Winforms DataGridView, and its first column is an unbound CheckBox column which is used to select/unselect a row. I want to hook up the check/uncheck event so that I can execute some logic after a row is selected or unselected. As ......

I thought I understand ViewState, until I came cross this exception: Failed to load viewstate. The control tree into which viewstate is being loaded must match the control tree that was used to save viewstate during the previous request. For example, when adding controls dynamically, the controls added during a post-back must match the type and position ......

Had this question when I was reading “Effective C#: 50 Specific Ways to Improve Your C#”. In the item 18: "Implement the Standard Dispose Pattern", the book recommends to implements IDisposable.Dispose() to do following tasks: 1. Freeing all unmanaged resources. 2. Freeing all managed resource (this includes unhooking events). 3. … My question is on ......

In my last post ViewState and Dynamic Control, I mentioned that ViewStateModeByIdAttribute can be used to change the default behavior of how ASP.NET finds the controls when ViewState data restored. Now, let's have a look how it can be done. For now, let's forget about ViewStateModeByIdAttribute for a second, and just have a simple page as following: ......

Copyright © Changhong Fu | Powered by: GeeksWithBlogs.net | Join free