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.