你可以得到的变量列表在C#在堆栈上? [英] Can you get a list of variables on the stack in C#?

查看:138
本文介绍了你可以得到的变量列表在C#在堆栈上?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所有的,只是想知道如果有可能的.NET / C#来获得栈和他们的价值观上的变量列表?我为我的应用程序创建一个异常处理程序,并超出了标准堆栈跟踪我也想看看的名称和值是在栈中的任何变量。任何想法,如果可以做到这一点?

All, just wondering if it's possible in .NET/C# to get a list of variables on the stack and their values? I am creating an exception handler for my app and beyond a standard stack trace I'd also like to see the names and values for any variables that are on the stack. Any idea if this can be done?

推荐答案

是的,StackFrame类可以帮你。

Yes, the StackFrame class can help you with that.

联动

沿着这些路线

var currentStackFrame = new StackFrame(1);
var props = currentStackFrame.GetMethod().GetParameters();

这篇关于你可以得到的变量列表在C#在堆栈上?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆