Reputation: 3916
Is there a .NET method that will produce a description of a C# method signature from a MethodInfo object. E.g. The following code might display "static int Main(string[])"
static int Main(string[] args)
{
var method = MethodInfo.GetCurrentMethod();
Console.WriteLine(DescribeMethodSignature(method));
}
Upvotes: 2
Views: 1249
Reputation: 11520
This isn't a complete answer, but there is code generation functionality in the Framework. Check out the CSharpCodeProvider, specifically the ICodeGenerator interface.
There is an example on CodeProject on how to use it.
Upvotes: 2
Reputation: 422310
.NET base class library does not have such a method. This is C# specific and it doesn't make sense to have it in a class library shared among many languages. It shouldn't be hard to write one though.
Upvotes: 1