private List<TreeViewItem> GetSubItems(Type type, string faction, DefaultType desiredType) { List<TreeViewItem> returnTreeItems = new List<TreeViewItem>(); System.Reflection.PropertyInfo[] properties = type.GetProperties(); foreach (System.Reflection.PropertyInfo propertyInfo in properties) { if (faction == propertyInfo.Name) { string[] items = propertyInfo.GetValue(desiredType, null) as string[]; foreach (string item in items) { TreeViewItem treeViewItem = new TreeViewItem(); treeViewItem.Header = item; returnTreeItems.Add(treeViewItem); } } } return returnTreeItems; }
private List <TreeViewItem> GetSubItems(Type type, string faction, DefaultType desiredType) { List <TreeViewItem> returnTreeItems = new List <TreeViewItem>(); System.Reflection.PropertyInfo[] properties = type.GetProperties(); foreach (System.Reflection.PropertyInfo propertyInfo in properties) { if (faction == propertyInfo.Name) { string[] items = propertyInfo.GetValue(desiredType, null) as string[]; foreach (string item in items) { TreeViewItem treeViewItem = new TreeViewItem(); treeViewItem.Header = item; returnTreeItems.Add(treeViewItem); } } } return(returnTreeItems); }