ObjectInfo.Print Method

Renders the property names and values of the specified object and of any subobjects.

Namespace:  System.Web.Helpers
Assembly:  System.Web.Helpers (in System.Web.Helpers.dll)

public static HelperResult Print(
	Object value,
	int depth,
	int enumerationLength


Type: System.Object
The object to render information for.
Type: System.Int32
Optional. Specifies the depth of nested subobjects to render information for. The default is 10.
Type: System.Int32
Optional. Specifies the maximum number of characters that the method displays for object values. The default is 1000.

Return Value

Type: System.Web.WebPages.HelperResult
For a simple variable, returns the type and the value. For an object that contains multiple items, returns the property name or key and the value for each property.


depth is less than zero.


enumerationLength is less than or equal to zero.

Use the Print method to help analyze and debug your code by rendering information about objects.

The depth parameter indicates how many nested levels of subobjects you want the method to render property information for. A nested object occurs when the object that you pass to the method references another object. For example, you might pass a collection object that references multiple Employee objects. An Employee object in turn might have a HomeAddress property that references another object. In this scenario there are three levels of nesting, and the Print method can display property information for all the objects and their properties.

Security noteSecurity Note

Remove all calls to the Print(Object, Int32, Int32) method from production code. Otherwise, information about the objects in the code will be displayed to site visitors, which might be a security risk.