private void AddNestedPropertyToTree(PropertyInfo[] property, ExplorerItem propertyType)
{
if (property == null)
{
throw new ArgumentNullException("property");
}
if (propertyType == null)
{
throw new ArgumentNullException("propertyType");
}
var oldPropertyType = propertyType;
foreach (var prop in property)
{
propertyType = new ExplorerItem(prop.Name, ExplorerItemKind.Property, ExplorerIcon.Column)
{
ToolTipText = "Property Type: " + prop.PropertyType.Name,
DragText = prop.Name,
Children = new List<ExplorerItem>(),
IsEnumerable = true
};
oldPropertyType.Children.Add(propertyType);
if (!(prop.PropertyType.IsPrimitive || prop.PropertyType.Namespace.Contains("System")))
{
this.AddNestedPropertyToTree(prop.PropertyType.GetProperties(), propertyType);
}
}
}