C# Dynamic Binding – Language Binding

Language binding is a form of dynamic binding which occurs when a dynamic object does not implement IDynamicMetaObjectProvider. Language binding comes in handy when working around imperfectly designed types or the inherent limitations in the .NET type system. A common problem is that when using numeric types is they have no common interface. Using dynamic […]

Read more

C# Dynamic Binding – Custom Binding

Custom binding is a form of dynamic binding which occurs when a dynamic object implements IDynamicMetaObjectProvider (IDMOP). Whilst you can implement IDynamicMetaObjectProvider on types that you which are written in C#, the more common use-case is that you have been given an IDMOP object from a dynamic language (such as IronPython or IronRuby) that is […]

Read more

C# Dynamic Binding

Dynamic binding in C# defers binding (ie the process of resolving types, operators and members) from compile time to runtime. Dynamic binding is used when you know w that a certain function, member, or operation exists at compile time but the compiler does not. This normally occurs when interoperating with dynamic languages (like IronPython) or […]

Read more

Interoperating C# with Dynamic Languages

Despite the fact that C# 4.0 supports dynamic binding using the dynamic keyword, it doesn’t go as far as to allow executing an expression described in a string at runtime such as: string expr = “2 * 4″; // We can’t “execute” expr This is due to the fact that the code to translate a string to […]

Read more

C# Await

Await is a new keyword introduced with C# 5.0 to facilitate its new asynchronous programming model. In C3 5.0 asynchronous functions are declared with the new async keyword, and must contain one or more await expressions. In C# 5.0, await is used in conjunction with Tasks (parallel programming), in very general terms it allows you […]

Read more

C# Async

Async is a new keyword added in C# 5.0 which is a key part of the asynchronous programming model. In C#, Async is modifier which is added to a method which denotes that the method contains control flow which involves waiting for asynchronous operations and will therefore be rewritten by the compiler to ensure that […]

Read more

SQL Azure Query Optimization

This article demonstrates how to optimize the performance of SQL Azure databases.

Read more

Compressing in Memory using MemoryStream

Sometimes you need to compress entirely in memory. Here’s how to use a MemoryStream for this purpose: byte[] data = new byte[1000]; // We would expect a good compression ratio from an empty array! var msObj = new MemoryStream(); using (Stream ds = new DeflateStream (msObj, CompressionMode.Compress)) ds.Write (data, 0, data.Length); byte[] compressed = msObj.ToArray(); Console.WriteLine (compressed.Length); […]

Read more

Sending Mail in .NET Using SmtpClient

The .NET SmtpClient class which is in the System.Net.Mail namespace enables the sending of mail through the ubiquitous Simple Mail Transfer Protocol (SMTP). To send a simple text-based mail, first instantiate an SmtpClient object, set its Host property to your SMTP server address, and finally call Send: SmtpClient clientObj = new SmtpClient(); clientObj.Host = “mail.myisp.net”; […]

Read more

PLINQ Tutorial

PLINQ (Parallel LINQ) is a parallelized version of LINQ to objects which supports all the existing LINQ operators and functionalities plus several additional options for control of the parallelization. This PLINQ turorial runs you thorugh the main concepts and features of PLINQ. The parallelized functionality has been added to LINQ  through the interface <IParallelEnumerable> which […]

Read more