About Jolt.NET Libraries

Inspired by the Boost C++ libraries, Jolt.NET aims to complement the .NET Base Class Library (BCL) with algorithms, data structures, and general productivity tools. It is the hope of the authors that the features of Jolt.NET will one day be part of, or represented in the BCL and the .NET Framework.

Generic Method Support Enabled

Revision #17390 includes support for parsing generic methods and emitting them via the ProxyTypeBuilder class. In addition to the generic type support described in a previous post, the following operations now demonstrate the complete set of public method proxy-generating operations (excluding explicit interface implementations, which are not really public).


void CreateMethods()
{
Type realSubjectType = typeof(System.Array);
ProxyTypeBuilder builder = new ProxyTypeBuilder("namespace", realSubjectType);

// ConvertAll and Find are implemented in terms of generic method arguments.
builder.AddMethod(realSubjectType.GetMethod("ConvertAll"));
builder.AddMethod(realSubjectType.GetMethod("Find"));

builder.CreateProxy();
}


This revision also includes the results of a tool-set upgrade to Visual Studio 9 (2008) with .NET 3.5 SP1. I took the liberty of simplifying some code by replacing many anonymous delegates with equivalent lambda expressions, and replacing explicit delegate types with specializations of System.Func.

I also noticed that upon removal of the initial explicit interface implementation feature, the ProxyMethodDeclarer and InterfaceMethodDeclarer types were very similar. The only difference between these types was that each type defined their own MethodAttributes value as a member variable. By factoring out this variable and moving its definition to a constructor, I was able to further simplify the code by removing one of the "method declarer" types. The following diagram shows the result of this refactoring and updates the class diagram from a previous post.

0 comments: