Click here to Skip to main content
15,888,113 members
Home / Discussions / C#
   

C#

 
AnswerRe: State Maintenance Pin
himanshu256116-Jun-09 2:01
himanshu256116-Jun-09 2:01 
GeneralRe: State Maintenance Pin
Henry Minute16-Jun-09 4:39
Henry Minute16-Jun-09 4:39 
Questionhow to access javascript using c# Pin
svt gdwl16-Jun-09 1:19
svt gdwl16-Jun-09 1:19 
Questionweb services Pin
harispa16-Jun-09 1:05
harispa16-Jun-09 1:05 
AnswerRe: web services Pin
Baran M16-Jun-09 1:23
Baran M16-Jun-09 1:23 
AnswerRe: web services Pin
Tom Deketelaere16-Jun-09 1:24
professionalTom Deketelaere16-Jun-09 1:24 
QuestionProblem with while loop and text file Pin
kallileo16-Jun-09 0:56
kallileo16-Jun-09 0:56 
AnswerRe: Problem with while loop and text file [modified] Pin
Luc Pattyn16-Jun-09 1:03
sitebuilderLuc Pattyn16-Jun-09 1:03 
Hi,

your code reads each stream once; i.e. for the first line of the first file, the entire content of the second file is read, then everything comes to a halt since sr2 has reached the end-of-stream condition.

if you want to have all combinations of lines from file1 and file2, then you should:
- either open the second file inside the while loop reading file1 (hence reopening it for every line of file1);
- or reposition sr2 at the beginning over and over again.

BTW:
Your try-finally construct will swallow any exception that may occur. I recommend you add catch(Exception exc) {Console.WriteLine(exc.ToString());} to visualize most problems that may (and sooner or later will) occur.

[CORRECTION]Exceptions don't get swallowed by finally blocks, they survive the try-finally construct and will have to be catched at some outer level [/CORRECTION]

Smile | :)

Luc Pattyn [Forum Guidelines] [My Articles]

DISCLAIMER: this message may have been modified by others; it may no longer reflect what I intended, and may contain bad advice; use at your own risk and with extreme care.

modified on Tuesday, June 16, 2009 8:39 AM

GeneralRe: Problem with while loop and text file Pin
OriginalGriff16-Jun-09 1:11
mveOriginalGriff16-Jun-09 1:11 
GeneralRe: Problem with while loop and text file Pin
Le centriste16-Jun-09 2:18
Le centriste16-Jun-09 2:18 
GeneralRe: Problem with while loop and text file Pin
Luc Pattyn16-Jun-09 2:42
sitebuilderLuc Pattyn16-Jun-09 2:42 
GeneralRe: Problem with while loop and text file Pin
kallileo16-Jun-09 2:46
kallileo16-Jun-09 2:46 
QuestionMultiple user accessing single DB Pin
Hum Dum16-Jun-09 0:50
Hum Dum16-Jun-09 0:50 
AnswerRe: Multiple user accessing single DB Pin
Tom Deketelaere16-Jun-09 1:22
professionalTom Deketelaere16-Jun-09 1:22 
GeneralRe: Multiple user accessing single DB Pin
Hum Dum16-Jun-09 18:55
Hum Dum16-Jun-09 18:55 
GeneralRe: Multiple user accessing single DB Pin
Tom Deketelaere16-Jun-09 21:09
professionalTom Deketelaere16-Jun-09 21:09 
AnswerRe: Multiple user accessing single DB Pin
Nagy Vilmos16-Jun-09 2:35
professionalNagy Vilmos16-Jun-09 2:35 
GeneralRe: Multiple user accessing single DB Pin
Hum Dum16-Jun-09 18:58
Hum Dum16-Jun-09 18:58 
AnswerRe: Multiple user accessing single DB Pin
OriginalGriff16-Jun-09 4:40
mveOriginalGriff16-Jun-09 4:40 
Questioncontroling cells in TableLayoutPanel Pin
samy10016-Jun-09 0:43
samy10016-Jun-09 0:43 
AnswerRe: controling cells in TableLayoutPanel Pin
OriginalGriff16-Jun-09 1:05
mveOriginalGriff16-Jun-09 1:05 
QuestionRemote Desktop Connection Pin
singhdurgesh16-Jun-09 0:17
singhdurgesh16-Jun-09 0:17 
AnswerRe: Remote Desktop Connection [modified] Pin
Baran M16-Jun-09 1:38
Baran M16-Jun-09 1:38 
GeneralRe: Remote Desktop Connection Pin
singhdurgesh16-Jun-09 1:56
singhdurgesh16-Jun-09 1:56 
GeneralRe: Remote Desktop Connection Pin
Baran M16-Jun-09 2:03
Baran M16-Jun-09 2:03 

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.