BclExtras Library

I published a .Net utility library on Code Gallery today called BclExtras.  It’s a set of classes meant to be used in addition to the standard .Net base class libraries (BCL).  The main focuses of the library are functional programming, multi-threading, LINQ extensions, unit testing and API’s designed to support type inference. This project evolved…


Is IntPtr(long) truncating?

The short answer is: No, not when it matters A colleague and I were discussing a particular scenario around IntPtr,PInvoke and 64 bit correctness.  Eventually our discussion lead us to the IntPtr constructor which takes a long.  To my surprise the code for the constructor is the following. public unsafe IntPtr(long value) { this.m_value =…


RantPack – A utility library

I often post code examples, samples and snippets on this blog.  Many of these samples are a part of a utility library I’ve been writing and maintaining for many years now.  Essentially since I got involved in DotNet programming. I write a lot of code for internal apps, demos and hobby projects.  Having a utility library to…


IEnumerable and IEnumerable(Of T) 2

Quick follow up to my earlier post.  Fixing this issue in C# is even easier because of the existence of iterators.  public static IEnumerable<object> Shim(System.Collections.IEnumerable enumerable) { foreach (var cur in enumerable) { yield return cur; } }


.Net Framework Source Code

If you haven’t heard the news yet, you can read the full article on ScottGu’s Blog.  In summary Microsoft has released the source code for the .Net Framework in such a way that you can step into the Framework while debugging.  IMHO this is great for users because it allows us to get a lot…


Closures in VB Part 6: Limitations

For previous articles in this series please see … Part 1: Introduction Part 2: Method Calls Part 3: Scope Part 4: Variable Lifetime Part 5: Looping As powerful as closures are in the language they do have a few limitations.  We worked hard in Orcas to put as few limitations in Orcas as possible.  Below…

Detecting if you are an Admin

This came up on an internal alias.  A customer wanted to know how to determine if there were running as an admin in a tool.  Below is a sample program that will print out whether or not you are the machine admin or a member of the machine administrators group.    This is essentially the…

Coding Quiz: Anonymous Type Types

Question: How can you create a variable in VB which is typed as an anonymous type but not actually create an instance of that type? Answer in comments.  Note, doing this is not particularly useful it came about while I was playing around with a feature a few days ago.



While investigating a recent bug I found about an interesting return for GetParamForMethodIndex.  On a perfectly verifiable assembly, a call to GetParamForMethodIndex was returning a failure code. After some searching I found the return code was CLDB_E_RECORD_NOTFOUND. I was surprised at first because it’s a verifiable assembly so how could the record for a parameter I knew…

Closures in VB Part 5: Looping

For previous articles in the series please see Part 1: Introduction Part 2: Method Calls Part 3: Scope Part 4: Variable Lifetime Once again sorry for the long delay between posts.  Looping structures can cause unintended consequences when used with Lambda expressions.  The problem occurs because lambda expressions do not execute when they are constructed…