void Nish(char* szBlog);

Nish’s thoughts on MFC, C++/CLI and .NET

void Nish(char* szBlog); header image 4

Entries from June 2009

A boolean lock using IDisposable

June 23rd, 2009 · 6 Comments

While there are more complex and functional lock mechanisms, I wanted a very simple lock that would tell me if an operation was locked or not. Normally I would just have a flag that’d be true or false, but I found that it was not always easy to remember to set the flag on or [...]

[Read more →]

Tags: C#/.NET

Checking for Design-Mode

June 21st, 2009 · 2 Comments

The DesignMode property does not always return the correct value, specially for nested controls or for child controls instantiated in their parent control’s constructors. One workaround is to check for LicenseManager.UsageMode and see if it’s equal to LicenseUsageMode.Runtime, but even that won’t work all the time. It will always return Runtime from event handlers and [...]

[Read more →]

Tags: C#/.NET · Windows Forms

Exposing List<T> vs IList<T>

June 14th, 2009 · 4 Comments

Unless you specifically want to expose a List<T> via a public interface (either as a return type or as a method argument), it’s a better idea to expose an IList<T>, ICollection<T>, or even an IEnumerable<T> depending on your needs. Recently I had to implement a generic list class that implemented property notifications and for this [...]

[Read more →]

Tags: C#/.NET