Click here to Skip to main content
15,914,642 members
Home / Discussions / C#
   

C#

 
GeneralRe: programming parallel port in c# Pin
Dave Kreskowiak12-Feb-09 11:28
mveDave Kreskowiak12-Feb-09 11:28 
GeneralRe: programming parallel port in c# Pin
orked mohamed13-Feb-09 2:31
orked mohamed13-Feb-09 2:31 
GeneralRe: programming parallel port in c# Pin
Dave Kreskowiak13-Feb-09 12:07
mveDave Kreskowiak13-Feb-09 12:07 
Question[Message Deleted] Pin
MS Lee11-Feb-09 21:13
MS Lee11-Feb-09 21:13 
AnswerRe: reading, updating a text file through C# Pin
Deresen11-Feb-09 22:20
Deresen11-Feb-09 22:20 
AnswerRe: [Message Deleted] Pin
jas0n2312-Feb-09 0:48
jas0n2312-Feb-09 0:48 
QuestionProject Pin
mrithula811-Feb-09 20:32
mrithula811-Feb-09 20:32 
AnswerRe: Project Pin
Rob Philpott11-Feb-09 22:29
Rob Philpott11-Feb-09 22:29 
QuestionHow to make a setup of windows application Pin
Rameez Raja11-Feb-09 20:17
Rameez Raja11-Feb-09 20:17 
AnswerRe: How to make a setup of windows application Pin
Eddy Vluggen11-Feb-09 20:45
professionalEddy Vluggen11-Feb-09 20:45 
AnswerRe: How to make a setup of windows application Pin
Vimalsoft(Pty) Ltd11-Feb-09 22:38
professionalVimalsoft(Pty) Ltd11-Feb-09 22:38 
AnswerRe: How to make a setup of windows application Pin
erfi11-Feb-09 23:19
erfi11-Feb-09 23:19 
AnswerRe: How to make a setup of windows application Pin
DJ-Boris12-Feb-09 0:10
DJ-Boris12-Feb-09 0:10 
QuestionTreeView Pin
Udayaraju11-Feb-09 19:54
Udayaraju11-Feb-09 19:54 
AnswerRe: TreeView Pin
Udayaraju12-Feb-09 1:15
Udayaraju12-Feb-09 1:15 
AnswerRe: TreeView Pin
Jimmanuel12-Feb-09 3:07
Jimmanuel12-Feb-09 3:07 
Udayaraju wrote:
Is there any other way of implementing
like Switch or any other methods.


create functions to break the processing up into smaller routines. For example:

if (table != null)
{
    foreach (DataRow row in table.Rows)
    {
            MainNode = new TreeNode(row.ItemArray[0].ToString());
            MainNode.Name = row.ItemArray[0].ToString();
            ProcessRow(row, MainNode);
    }
}

private void ProcessRow (DataRow row, TreeNode MainNode)
{
   // ... 
}


and then try to break up the ProcessRow function into smaller ones. This should make it easier to see what's going on and possibly reduce some code duplication.

Visual Studio has built in refactoring tools to help with this kind of thing. Try highlighting all of the text inside of the foreach loop, goto the "Refactor" menu of the main VS toolbar and select "Extract Method" to have VS help break up your functions.



GeneralRe: TreeView Pin
Udayaraju15-Feb-09 4:53
Udayaraju15-Feb-09 4:53 
GeneralRe: TreeView Pin
Udayaraju15-Feb-09 5:09
Udayaraju15-Feb-09 5:09 
GeneralRe: TreeView Pin
Udayaraju15-Feb-09 5:20
Udayaraju15-Feb-09 5:20 
QuestionFile Processing Error Pin
MumbleB11-Feb-09 19:53
MumbleB11-Feb-09 19:53 
AnswerRe: File Processing Error Pin
ABitSmart11-Feb-09 21:04
ABitSmart11-Feb-09 21:04 
GeneralRe: File Processing Error Pin
MumbleB11-Feb-09 21:08
MumbleB11-Feb-09 21:08 
AnswerRe: File Processing Error Pin
Eddy Vluggen11-Feb-09 21:25
professionalEddy Vluggen11-Feb-09 21:25 
QuestionOn button click-context menu strip Pin
Udayaraju11-Feb-09 19:47
Udayaraju11-Feb-09 19:47 
AnswerRe: On button click-context menu strip Pin
ABitSmart11-Feb-09 20:08
ABitSmart11-Feb-09 20:08 

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.