Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the .NET equivalent of PHP var_dump?

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?

like image 318
George Mauer Avatar asked Sep 18 '08 15:09

George Mauer


People also ask

What is Var_dump PHP?

To dump information about a variable, use the var_dump in PHP. This function provides structured data about the specified variable, including its type and value. Recursively, arrays and objects are examined, with values indented to demonstrate structure. This function works well with expressions as well.

What is the difference between Print_r and Var_dump?

var_dump() displays values along with data types as output. print_r() displays only value as output. It does not have any return type. It will return a value that is in string format.

What is Var_dump in Javascript?

The var_dump() function is a built-in function of PHP that dumps the information about the variables. This information includes the data type and value of the variable. In case of string, it also includes the size of the string passed inside the function.

What value will Var_dump show that Echo will not show coursera?

The var-dump is display the datatype as well as value while echo only display the value. Explanation: In Php the var-dump function is used for displaying the datatype as well the value . The var-dump () does not return anythings it means there is no datatype of var-dump() function.


1 Answers

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.

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 Source Code

like image 179
user13810 Avatar answered Sep 30 '22 13:09

user13810