Post navigation

One of the core language features that C# relies on heavily when working with Linq is implicit typing. Implicit typing allows users to create anonymous types, which are simply types constructed at compile time based on the RHS expression specified by using the new keyword in conjunction with the object initializer syntax.

Implicit typing also works with predefined types, however it’s important to note the difference between the two syntactically similar statements, as they yield very different results:

var a = new int [] { 42 };

Create a new instance of a predefined type – an array containing a single element with the integer value ’42’.

var b = new { a = 42 };

Creates a new compiler generated type – consisting of a single field, decorated with the value ‘a’, of the integer type. This instance contains the value ’42’ in its ‘a’ field.

In my previous post on Native and Managed Interoperability I briefly mentioned that “Managed C++” has it’s own unique interoperability features. Technically, the “Managed C++” syntax is officially depreciated and has been superseded by CLI / C++, or the Common Language Infrastructure.

However, the same underlying concepts still apply. CLI / C++ is a very powerful language that allows developers to bridge the gap between managed BCL components and native components under a single managed context.

One of the first things that truly broadened my horizons on how amazing software development could be, was when I saw my first “Demo”. A demo is simply a non-interactive real-time display of a visualization effect. Some of the most classic (and simple) examples are the Starfield, Plasma, Fire and Water. The real appeal of these first demos was that developers, on basically identical hardware, could really display their algorithm optimization talents – some going as far as exploiting hardware defects to achieve faster rendering routines.

When I first began learning how to write software it was on a Windows 95 box using Visual Basic 3. Visual Basic provided a great learning tool for getting into development. It doesn’t have a high price for entry, as just about anyone with a little inclination can pick it up and use the RAD tools it provides. However, I eventually grew of it and moved to learning C and the working with the Win32 API directly. Ever since, I have been absolutely hooked. I really enjoy working with the native Windows API (yes, I’m one of the few), so naturally when I started picking up managed languages I was immensely curious about the power of interoperability.

A common data type we deal with in software construction is the Universally Unique Identifier, also known as Globally Unique Identifier to those of us in the Microsoft community. However, I often find that a lot of developers have a great deal of misunderstanding when it comes to using this type, and how they’re actually generated. The basic concept behind these Ids is well-known, they offer a guaranteed (or highly unlikely depending on the generation method) unique set of 32 hexadecimal characters (or 16 bytes/octets – 128 bits) that are by all appearances completely random (more on this later). Conventionally represented by 5 hyphen separated groups often encompassed with definite brackets, e.g. “{8-4-4-4-12}”.