namespace Unosquare.Swan.Reflection { using System; using System.Reflection; using Attributes; /// /// Represents a Property object from a Object Reflection Property with extended values. /// public class ExtendedPropertyInfo { /// /// Initializes a new instance of the class. /// /// The property information. public ExtendedPropertyInfo(PropertyInfo propertyInfo) { if (propertyInfo == null) { throw new ArgumentNullException(nameof(propertyInfo)); } Property = propertyInfo.Name; DataType = propertyInfo.PropertyType.Name; foreach (PropertyDisplayAttribute display in Runtime.AttributeCache.Retrieve(propertyInfo, true)) { Name = display.Name; Description = display.Description; GroupName = display.GroupName; DefaultValue = display.DefaultValue; } } /// /// Gets or sets the property. /// /// /// The property. /// public string Property { get; } /// /// Gets or sets the type of the data. /// /// /// The type of the data. /// public string DataType { get; } /// /// Gets or sets the value. /// /// /// The value. /// public object Value { get; set; } /// /// Gets or sets the default value. /// /// /// The default value. /// public object DefaultValue { get; } /// /// Gets or sets the name. /// /// /// The name. /// public string Name { get; } /// /// Gets or sets the description. /// /// /// The description. /// public string Description { get; } /// /// Gets or sets the name of the group. /// /// /// The name of the group. /// public string GroupName { get; } } /// /// Represents a Property object from a Object Reflection Property with extended values. /// /// The type of the object. public class ExtendedPropertyInfo : ExtendedPropertyInfo { /// /// Initializes a new instance of the class. /// /// The property. public ExtendedPropertyInfo(string property) : base(typeof(T).GetProperty(property)) { } } }