Hi, >> What about array types? You also need to replace the T in "T[]".
Good point! > I think it should be pretty easy to cook one by switching on the > .MetadataType in Visit, pretty much like the v2.0 ExpressionVisitor. Might we have both an in-place visitor and a cloning visitor? The cloning visitor would, as its default implementation, return a deep clone of whatever was visited. It could include all the tricky logic for replacing generic types, fixing up the branch targets for cloned instructions, etc.. -Alex On Mon, May 2, 2011 at 4:36 AM, Jb Evain <[email protected]> wrote: > Hey Daniel, > > On Mon, May 2, 2011 at 12:44 PM, Daniel Grunwald > <[email protected]> wrote: >> I think replacing types is something that belongs directly into Cecil -- so >> far, all of my projects using Cecil have required something like this, even >> if its just for determining the parameter types of a generic method call. > > Or at least in Cecil.Rocks. > >> The visitor pattern works quite well for this - take a look at how >> System.Linq.Expressions.ExpressionVisitor can be used for replacing nodes >> within an expression tree. And it's useful for more than just replacements. > > I think it should be pretty easy to cook one by switching on the > .MetadataType in Visit, pretty much like the v2.0 ExpressionVisitor. > > Jb > > -- > -- > mono-cecil -- -- mono-cecil
