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?
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.
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.
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.
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With