get local variable names defined in a method using reflection in C#.net
But again how do i map this information with the information(LocalVariables defined in a method)"
With SymReader the locals can be found via ISymbolMethod.RootScope. Here's a short example:
var locals = typeof(TestClass).GetMethod("GetStringRepresentation").GetMethodBody().LocalVariables;
foreach (var scope in met.RootScope.GetChildren()) {
foreach (var loc in scope.GetLocals()) {
Console.WriteLine("{0}: {1} {2}", loc.AddressField1, locals.FirstOrDefault(l => l.LocalIndex == loc.AddressField1).LocalType, loc.Name);
}
}
It's incomplete (should be recursive to be able to enumerate all scopes, may need some sanity checks like verifying if the AddressKind is ILOffset) but you should get the idea.

浙公网安备 33010602011771号