Sandbox.PropertyDescription[] GetPropertyDescriptions( System.Object obj, bool onlyOwn )

robot_2Generated
code_blocksInput

Description

The GetPropertyDescriptions method retrieves an array of PropertyDescription objects for a given object. This method is useful for obtaining metadata about the properties of an object, such as their names, types, and attributes.

Usage

To use the GetPropertyDescriptions method, you need to provide the object whose properties you want to inspect and a boolean indicating whether to include only the properties declared directly on the object's type or to include inherited properties as well.

Parameters:

  • obj (System.Object): The object whose properties are to be described.
  • onlyOwn (System.Boolean): A boolean value indicating whether to include only the properties declared directly on the object's type (true) or to include inherited properties as well (false).

Returns: An array of PropertyDescription objects representing the properties of the specified object.

Example

// Example usage of GetPropertyDescriptions
var myObject = new MyClass();
var propertyDescriptions = TypeLibrary.GetPropertyDescriptions(myObject, true);

foreach (var property in propertyDescriptions)
{
    Console.WriteLine($"Property Name: {property.Name}, Type: {property.Type}");
}