.NET与PHP var_dump等效吗? [英] What is the .NET equivalent of PHP var_dump?

查看:104
本文介绍了.NET与PHP var_dump等效吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我记得前一段时间看到,Reflection命名空间中有一些方法可以在对象的所有属性上递归运行 ToString()并对其进行格式化显示。

I remember seeing a while ago that there is some method in maybe the Reflection namespace that would recursively run ToString() on all of an object's properties and format it nicely for display.

是的,我知道我想要的所有内容都可以通过调试器访问,但是我想知道是否有人知道该命令?

Yes, I know everything I could want will be accessible through the debugger, but I'm wondering if anyone knows that command?

推荐答案

我认为您要查找的是/被称为ObjectDumper。它使用反射来遍历并输出对象的所有不同属性。我是在学习LINQ时第一次听说它的,并且《 Linq in Action》一书中的大多数示例都使用它。

I think what you're looking for is/was called ObjectDumper. It uses reflection to iterate through and output all of the different properties for an object. I first heard about it while learning LINQ, and most of the examples in the Linq in Action book use it.

看来Microsoft最终没有将其包括在内。虽然是Linq的版本,但是代码仍然很疯狂。我对它做了一个快速的Google搜索,这是它的链接:

It appears that Microsoft didn't include it in the final version of Linq though, but the code is still out in the wild. I did a quick google search for it and here's a link to it:

ObjectDumper源代码

这篇关于.NET与PHP var_dump等效吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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