Share via


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)

Syntax

'Declaration
Public Shared Function Print ( _
    value As Object, _
    depth As Integer, _
    enumerationLength As Integer _
) As HelperResult
'Usage
Dim value As Object 
Dim depth As Integer 
Dim enumerationLength As Integer 
Dim returnValue As HelperResult 

returnValue = ObjectInfo.Print(value, depth, _
    enumerationLength)
public static HelperResult Print(
    Object value,
    int depth,
    int enumerationLength
)
public:
static HelperResult^ Print(
    Object^ value, 
    int depth, 
    int enumerationLength
)
static member Print : 
        value:Object * 
        depth:int * 
        enumerationLength:int -> HelperResult
public static function Print(
    value : Object, 
    depth : int, 
    enumerationLength : int
) : HelperResult

Parameters

  • value
    Type: System.Object
    The object to render information for.
  • depth
    Type: System.Int32
    Optional. Specifies the depth of nested subobjects to render information for. The default is 10.
  • enumerationLength
    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.

Exceptions

Exception Condition
ArgumentOutOfRangeException

depth is less than zero.

ArgumentOutOfRangeException

enumerationLength is less than or equal to zero.

Remarks

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.

See Also

Reference

ObjectInfo Class

System.Web.Helpers Namespace