Local variable type inference in C# 3.0

In C# 1.0 type declaration was very simple: –          Specify the type name (if an array then append [] to the end of the type) –          Follow by a local variable name Here are some examples of this: int i = 23; double[] ds = new double[] { 1.0, 2.0 }; In C# 2.0 with…

1

Coordination Data Structures – WriteOnce<T>

This is an article in a series of blog entries describing a set of new Coordination Data Structures (CDS) introduced in the June 2008 CTP of the Parallel Extensions for .NET Framework. In C#, when a field declaration includes a readonly modifier, assignments to the fields introduced by the declaration can only occur as part…

1

ThreadAbortException and Unmanaged Code

As you are probably aware Thread.Abort() raises a ThreadAbortException in the thread on which it is invoked, to begin the process of terminating the thread. Please note that if Abort is called on a managed thread while it is executing unmanaged code, a ThreadAbortException is not thrown until the thread returns to managed code. That…

1

SQL Server 2005 Compact Edition is now available

SQL Server 2005 Compact edition runs as an in-process application, with a very small footprint  (less than 2 MB disk footprint) offering you a good subset of the T-SQL features, and replication features of a full blown SQL install. DB Size is capped at 4GB, should you want to be able to deal with that…

1

More on self-replicating tasks

Some more stuff to remember when dealing with self-replicating tasks. (See my earlier post for an introduction to Parallel FX and self-replicating tasks): –          Self-replicating tasks should have an inter-replica communication mechanism for communicating the progress/details of the activity. This depends on what the activity is trying to achieve. See here for an example. –         …

1

WCF Tools

WCF provides a number of tools that make it easier to create, deploy, and administer WCF applications. Tool Name Description COM+ Service Model Configuration Tool (ComSvcConfig.exe) This is a utility used to configure service model integration for COM+ applications. Using this tool you can expose an interface within your COM+ component as a WCF web…


Non-CLS Exceptions

Many developers are not aware that according to CLR it is perfectly OK to throw exceptions which are NOT derived from System.Exception: Exceptions such as DateTime, Int64 and String. Although languages such as C# do not allows programmers to throw these types of exceptions it should still be possible to catch non-CLS compliant exceptions using…


SQL Service Broker: The Impatient Way!

For those of you who are interested in creating your first SQL Server 2005 Service Broker conversation but are impatient as I am, just grab the code below and give it a try: — Enable service brokeralter database [YOUR_DB_NAME] set enable_broker — Create a message type. You can also specify —  An XML schema to…


Building a LINQ Provider

Throughout this article, I will build a simple IQueryable provider similar to the LINQ to SQL provider demonstrating what is needed to build a custom provider that is capable of executing LINQ queries and performing create, update and delete operations. Read the rest on MSDN at http://msdn.microsoft.com/en-us/vcsharp/ee672195.aspx Pedram  


Use of string.Format for the purpose of tracing

Application tracing is usually turned off on production releases. Therefore it is recommended not to use string formatting methods if their output is being ignored. string.Format is usually an expensive method and should be avoided if its output is not consumed: Log.Write(string.Format(“User {0} tried to log on at {1}”, userName, logonTime)); Many tracing and logging…