Currently viewing the category: "C#"

An introduction to MongoDB

On February 28, 2011 By

10 years ago we have had no social network service in such a scale we used to see these days. Facebook, for instance, has got more than 600 million active users who modify their personal profiles, exchange messages, play games and the like every single day. Consider the total committed transactions per second caused […]

Continue Reading

As the title implies, today’s post is dedicated to developing a custom ASP.NET server control that lets the user pick up a given color from a predefined color set. Please note that I’m not going to mimic Adobe Photoshop’s color picker, since it’s what jPicker and colorPicker do.

I just wanted a simple, […]

Continue Reading

SQL Server Savepoints

On January 6, 2009 By

There are some conditions when you need to rollback an implicit or explicit transaction to a given point inside the transaction. There are two ways to address such a need:

1. You can use the T-SQL to address such a problem:

2. Use the SqlTransaction’s Save method within your code. Please note that this method […]

Continue Reading

Empty Fields

On May 3, 2008 By

Hi folks,
There are some cases when you need to pass an empty EventArgs to an event handler. I’ve been seeing the following code (which makes me really sick) lately over and over again:

Take a look at MSDN and you’ll see there’s a static read only field named Empty in the EventArgs class […]

Continue Reading

Hi folks,
I’ve been recently asked to explain how to suppress the flicker issue in C#’s ListView. As far as you know if you try to modify the list contents, the background of the control will be redrawn – which is the source of the flickering problem.

To stop this, you need to subclass […]

Continue Reading

For those who are not familiar with MFC, the CWaitCursor class provides a way to show a wait cursor, which is usually displayed as an hourglass, while you’re doing a lengthy operation. There are plenty of ways to modify the pointing device’s cursor under C#, however, the one I’m going to bring up […]

Continue Reading

I was recently asked to present how to open/close a CD tray programatically using C#. The Media Control Interface (MCI) is the way to go. According to MSDN, the Media Control Interface (MCI) provides standard commands for playing multimedia devices and recording multimedia resource files. These commands are a generic interface to nearly every kind […]

Continue Reading

There are two ways to copy an object: Shallow and Deep.

A shallow copy of an object copies all the member variables bit by bit if the member field is a value type. For reference types, the reference is copied but the referred object is not. This means that both the original objects and its […]

Continue Reading

The Object class of the .NET framework has got a virtual method, say, GetHashCode that other classes could override to provide a custom implementation. This function is suitable for use in hashing algorithms like a hash table. The return value [of the default implementation] is and has never been meant to be used as a […]

Continue Reading

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!