Click here to Skip to main content
15,924,581 members
Home / Discussions / C#
   

C#

 
QuestionPerformance issue Pin
DJ2456-Jan-09 1:00
DJ2456-Jan-09 1:00 
AnswerRe: Performance issue Pin
Wendelius6-Jan-09 1:19
mentorWendelius6-Jan-09 1:19 
GeneralRe: Performance issue Pin
DJ2457-Jan-09 18:19
DJ2457-Jan-09 18:19 
GeneralRe: Performance issue Pin
Wendelius7-Jan-09 19:40
mentorWendelius7-Jan-09 19:40 
GeneralRe: Performance issue Pin
DJ2457-Jan-09 20:55
DJ2457-Jan-09 20:55 
GeneralRe: Performance issue Pin
Wendelius7-Jan-09 21:04
mentorWendelius7-Jan-09 21:04 
GeneralRe: Performance issue Pin
DJ2457-Jan-09 21:21
DJ2457-Jan-09 21:21 
GeneralRe: Performance issue Pin
Wendelius7-Jan-09 21:40
mentorWendelius7-Jan-09 21:40 
Lets start with the CheckUncheckChildNodes method.

You have an array removedFileList. Instead of using an array and always looping through it, use for example HashTable. Something like this when you add new files to the list (or whatever code you use when you add to the array):
private System.Collections.HashTable removedFileList = new System.Collections.HashTable();
...
// when adding to HashTable:
removedFileList.Add(node.FullPath, "");

Now when you have the CheckUncheckChildNodes method, you could modify your code to this:
...
                //check if the selected node already present in removedFileList,
                //if not add the node to initalFileList (which has the list of selected files and folders)
                if (removedFileList.ContainsKey(node.FullPath))
                    removedFileList.Remove(node.FullPath);
                //check all the filtered files in the selected node
                CheckUncheckFilteredFiles(node, node.Checked);
...

The same applies to the else section if the selected node is not checked.

That would speed up the execution and use less code. The same idea can be used in CheckUncheckFilteredFiles

The need to optimize rises from a bad design.My articles[^]

GeneralRe: Performance issue Pin
DJ2457-Jan-09 23:15
DJ2457-Jan-09 23:15 
GeneralRe: Performance issue Pin
Wendelius8-Jan-09 2:20
mentorWendelius8-Jan-09 2:20 
GeneralRe: Performance issue Pin
DJ2458-Jan-09 18:18
DJ2458-Jan-09 18:18 
Questionivalid token '=' in class , struct, or interface member declaration? Pin
dec826-Jan-09 0:58
dec826-Jan-09 0:58 
AnswerRe: ivalid token '=' in class , struct, or interface member declaration? Pin
Guffa6-Jan-09 1:06
Guffa6-Jan-09 1:06 
GeneralRe: ivalid token '=' in class , struct, or interface member declaration? Pin
dec826-Jan-09 1:16
dec826-Jan-09 1:16 
GeneralRe: ivalid token '=' in class , struct, or interface member declaration? Pin
Dragonfly_Lee6-Jan-09 2:34
Dragonfly_Lee6-Jan-09 2:34 
GeneralRe: ivalid token '=' in class , struct, or interface member declaration? Pin
Guffa6-Jan-09 2:35
Guffa6-Jan-09 2:35 
GeneralRe: ivalid token '=' in class , struct, or interface member declaration? Pin
Luc Pattyn6-Jan-09 2:37
sitebuilderLuc Pattyn6-Jan-09 2:37 
QuestionString Parsing Pin
mark_w_6-Jan-09 0:53
mark_w_6-Jan-09 0:53 
AnswerRe: String Parsing Pin
Guffa6-Jan-09 1:10
Guffa6-Jan-09 1:10 
AnswerRe: String Parsing Pin
benjymous6-Jan-09 2:58
benjymous6-Jan-09 2:58 
GeneralThanks Pin
mark_w_6-Jan-09 4:26
mark_w_6-Jan-09 4:26 
QuestionHDD rotations per minute Pin
adi.rusu6-Jan-09 0:42
adi.rusu6-Jan-09 0:42 
QuestionPOPUP WINDOW Pin
khosnur6-Jan-09 0:41
khosnur6-Jan-09 0:41 
AnswerRe: POPUP WINDOW Pin
rah_sin6-Jan-09 1:03
professionalrah_sin6-Jan-09 1:03 
QuestionGet Available Bandwidth TCP/IP Pin
satsumatable6-Jan-09 0:38
satsumatable6-Jan-09 0:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.