在运行时获取本地对象/变量的列表 [英] Get list of local objects/variables during runtime

查看:119
本文介绍了在运行时获取本地对象/变量的列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建一个简单的记录器来检查客户端发生的情况。如何获取当地人的列表(如调试时在visual studio中显示的)?



类似于当断点被击中时,当前现有的对象/变量实例在本地选项卡上显示,或者只要在日志上写入变量的当前值?

解决方案

有趣的事情。 .. / p>

我通常用反射和运行时数据的组合记录所有方法参数的名称和值,从来没有想过也捕捉到局部变量值...



这里有一些信息:



访问本地变量信息


I'm trying to create a simple logger to check what's happening on the client-side. How can I get the list of locals (as displayed on visual studio while debugging)?

kind of like when a breakpoint is hit, the current existing instances of objects/variables are shown on the Locals tab or should I just get the variable's current value whenever I write on the log?

解决方案

Interesting thing...

I usually log all method parameters names and values with a combination of Reflection and runtime data, never thought about also catching local variables values...

here some info:

Accessing Local Variable Information

这篇关于在运行时获取本地对象/变量的列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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