private void treeParseNodes_AfterSelect(object sender, TreeViewEventArgs e) { this.listProperties.Items.Clear(); if (this.treeParseNodes.SelectedNode == null) { return; } IParseNode node = this.treeParseNodes.SelectedNode.Tag as IParseNode; if (node == null) { return; } this.SelectNodeSource(node); Type t = node.GetType(); PropertyInfo[] infos = t.GetProperties(BindingFlags.FlattenHierarchy | BindingFlags.GetProperty | BindingFlags.Instance | BindingFlags.Public); foreach (PropertyInfo info in infos) { if (!(new string[] { "Tokens", "Comments" }).Contains(info.Name)) { object value = info.GetValue(node, null); if (value == null) { value = "<null>"; } this.listProperties.Items.Add(info.Name).SubItems.Add(String.Format("{0}", value)); } } foreach (IToken token in node.GetTokens()) { this.listProperties.Items.Add(String.Format("Token: {0}", token.GetType().Name)) .SubItems.Add(String.Format("{0}{1} - {2}: {3}", (token.IsValid ? "" : "ERROR: "), token.StartPosition, token.StopPosition, this.GetTokenValue(token))); } if (this.Errors.ContainsKey(node)) { foreach (string err in this.Errors[node]) { ListViewItem lvi = this.listProperties.Items.Add("Error:"); lvi.SubItems.Add(err).ForeColor = Color.Red; lvi.ForeColor = Color.Red; } } }