public static TreeView CreateTreeViewFor_MethodMappingsView(this Control targetControl, ascx_SourceCodeViewer sourceCodeViewer) { targetControl.clear(); var treeView = targetControl.add_TreeView() .sort(); Action<MethodMapping> showMethodMapping = (methodMapping)=>{ if (methodMapping.File.valid()) { sourceCodeViewer.open(methodMapping.File); sourceCodeViewer.editor().clearMarkers(); sourceCodeViewer.editor().caret(methodMapping.Start_Line,methodMapping.Start_Column); sourceCodeViewer.editor().selectTextWithColor(methodMapping.Start_Line, methodMapping.Start_Column, methodMapping.End_Line, methodMapping.End_Column); } }; treeView.afterSelect<MethodMapping>(showMethodMapping); treeView.afterSelect<List<MethodMapping>>( (methodMappings)=>showMethodMapping(methodMappings[0])); return treeView; }