Feeds:
Posts
Comments

Archive for the ‘C# 3.0 Tips’ Category

In this post I will demonstrate how to verify if a given password meet the current Windows password policy. We will use the NetValidatePasswordPolicy API for that. Instead of using C# pinvoke approach, we will call the API through Managed C++ then call the managed C++ DLL with C#. This approach will be much more cleaner [...]

Read Full Post »

As you may know, Windows is virtualizing some parts of the registry under 64 bit. So if you try to open, for example, this key : “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\90″, from a 32 bit C# application running on a 64 bit system, you will be redirected to : “HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SQL Server\90″ Why ? Because Windows uses [...]

Read Full Post »

Introduction When developping our applications we can experience than some reference types have the same behavior than value types. As a matter of fact there is no more references to the copied object . It’s the case for  System.String and System.Nullable<T> which are called immutable object because when affecting new value to these variables a [...]

Read Full Post »

Introduction When an assembly has been loaded in an Application Domain, the embeded code can be executed. This code can be executed in the current Application Domain or in another one, we will see how to proceed by differents way. For all the following examples we will use a namespace MyNameSpace containing 2 classes : [...]

Read Full Post »

IoC Pattern

Introduction: IoC (inversion of control) is a design pattern used to uncouple classes to avoid strong dependencies between them. As a matter of fact every system does not make assumptions about what other systems do or should do, so no side effect when replacing a system by another one. Let’s have a first example showing [...]

Read Full Post »

According to me, threading is the most interesting and exciting part of C#. Exploiting the power of multiple processors in order to build more faster and more responsive software is a great challenge. But to fully exploit this in your applications, you need to write multithreading code, which means learning some challenging new concepts. I’ll try as [...]

Read Full Post »

Yesterday, i was facing a curious problem on my form. I have a DateTimePicker control , and when i choose manually the date and i press Enter or Escape, i have an annoying sound. You know, this sound that is heard when Windows displays an error message box. I have bypassed the problem by creating [...]

Read Full Post »

If you have a multiple processors (or multi-core processor), you can use the Processor Affinity to direct a specific process to use a specified core. By this way, if your process always use the same core, the process will run more efficiently because of the cache re-use. You can set the Processor Affinity in the [...]

Read Full Post »

Generic delegate Func

Here’s a new feature introduced in C#3.0 :  Func Func is a new type used in all concerning delegate declarations. In this post, we will show you the different states in using delagates declaration between C#1.1, 2.0 and 3.5. The following examples show if a data is included in a given interval.  In C#1.0 the code [...]

Read Full Post »

Follow

Get every new post delivered to your Inbox.