Greg Beech's Website

March 2008 - Greg Beech's Tech Blog

  • Translating C# 3.0 query syntax for Linq-to-Objects, Part 2: SelectMany

    This is the second entry in a series demonstrating how C# 3.0 query syntax is translated into the underlying method calls for Linq-to-Objects, and that you can write your own versions of the Linq extension methods. In the first entry I outlined the types and collections I'd be using for this series, and looked at the translation of a simple Linq query with a single from clause to the Select extension...
    Filed under: ,
  • Translating C# 3.0 query syntax for Linq-to-Objects, Part 1: Select

    The Linq query syntax introduced in C# 3.0 is an extremely powerful way to manipulate collections of objects. Depending on the query provider the expression may be translated in a number of ways, such as SQL statements for Linq-to-SQL or XQuery expressions for Linq-to-XML , but the simplest is when you're dealing with collections of normal objects and the syntax is translated into method calls;...
    Filed under: ,
  • To var or not to var, implicit typing is the question

    The introduction of the var keyword in C# 3.0 was required to support anonymous types, however it may also be used to declare variables for named types. This seems to have sparked quite a lot of debate about where the use of var is appropriate. The C# Reference documentation page (linked previously) suggests that: Overuse of var can make source code less readable for others. It is recommended to use...
    Filed under:
  • Generating COM Interop types from IDL

    Recently I wrote a managed wrapper for BITS to use in blinkBox 's download manager application, which necessitates COM interop. This was made a little tricky due to the fact that BITS doesn't ship with primary interop assemblies or a type library; simply with an IDL interface definition file. However, using some command line tools it's quick to translate the IDL file into C# interop types...
Copyright (C) Greg Beech. All rights reserved.
Powered by Community Server (Non-Commercial Edition), by Telligent Systems