Closed WhitWaldo closed 1 year ago
Hello @WhitWaldo, thank you for submitting this issue. We will try to get back to you as soon as possible. Note to the PostSharp team, this ticket is being tracked in our dashboard under ID TP-33217.
You can use the buildMethod
parameter to set the name of the introduced method. For example:
builder.Advice.IntroduceMethod(
builder.Target, nameof(Template), buildMethod: methodBuilder => methodBuilder.Name = $"M{i}");
Is that sufficient for you?
Perfect - thank you!
I would like to write a single template to a type several times populating its generic types with different values. I'd like for it to be written a non-constant number of times meaning that I cannot simply write X number of templates and hook each up.
Rather, just as I can specify the name of a field myself, I'd like an overload added to
builder.Advice.IntroduceMethod
that allows me to specify my own name for the method, overriding whatever name is used for the template itself. This would allow me to simply then have the ability to loop through a collection of variations and increment my own method names as I introduced each one in a way I don't think is possible today.If this is possible today somehow though, could you share how I might do it?
Thank you!