Click here to Skip to main content
15,893,486 members
Home / Discussions / C#
   

C#

 
GeneralRe: Convert EBCDIC to ASCII and vice versa Pin
Alan Balkany15-May-09 3:31
Alan Balkany15-May-09 3:31 
AnswerRe: Convert EBCDIC to ASCII and vice versa Pin
Scott Barbour15-May-09 9:59
Scott Barbour15-May-09 9:59 
GeneralRe: Convert EBCDIC to ASCII and vice versa Pin
ishtine188-Jan-10 19:04
ishtine188-Jan-10 19:04 
GeneralRe: Convert EBCDIC to ASCII and vice versa Pin
frank_a3208-Feb-11 11:41
frank_a3208-Feb-11 11:41 
QuestionDatetime picker Pin
KIDYA15-May-09 2:07
KIDYA15-May-09 2:07 
AnswerRe: Datetime picker Pin
Eddy Vluggen15-May-09 2:47
professionalEddy Vluggen15-May-09 2:47 
AnswerRe: Datetime picker Pin
DaveyM6915-May-09 5:27
professionalDaveyM6915-May-09 5:27 
QuestionHow can I optimize this code Pin
MumbleB15-May-09 1:51
MumbleB15-May-09 1:51 
Hi guys. I have managed to resolve a proble I had yesterday with taking a value from one file and searching for it in another file. Now, my file1 containing the values I am searching for has approximately 2000 records in it. I pick up the first id in file1 and search for it in file2 which has approx 80000 records in it. Once the value has been found I replace it with another value from file1. The below code seems to taking forever to run. Is there anyway I can make this run much faster? Sniff | :^)
fileNot = textBox1.Text;
fileHid = textBox2.Text;
string[] lines = File.ReadAllLines(fileHid);
StreamWriter sw = new StreamWriter(outFile);
foreach (string line in lines)
{
    string oldhid = line.Substring(0, 11);
    string newhid = line.Substring(14, 11);
    StreamReader sr = new StreamReader(fileNot);
    string holdLine;
    while (!sr.EndOfStream)
    {
        holdLine = sr.ReadLine();
        string matchId = holdLine.Substring(0, 11);
        string noting = holdLine.Substring(11, 650).Trim();
        string dnot = holdLine.Substring(11, 2);
        if (oldhid == matchId && dnot != "D1")
        {
            sw.WriteLine(newhid + noting);
            break;
        }
    }
    sr.Close();
}
sw.Close();
swr.Close();


Any advice woudl be greatly appreciated.

Excellence is doing ordinary things extraordinarily well.

AnswerRe: How can I optimize this code Pin
Tom Deketelaere15-May-09 2:03
professionalTom Deketelaere15-May-09 2:03 
AnswerRe: How can I optimize this code [modified] Pin
fly90415-May-09 2:18
fly90415-May-09 2:18 
AnswerRe: How can I optimize this code Pin
Luc Pattyn15-May-09 3:16
sitebuilderLuc Pattyn15-May-09 3:16 
GeneralRe: How can I optimize this code Pin
Nagy Vilmos15-May-09 3:57
professionalNagy Vilmos15-May-09 3:57 
GeneralRe: How can I optimize this code Pin
Luc Pattyn15-May-09 4:02
sitebuilderLuc Pattyn15-May-09 4:02 
GeneralRe: How can I optimize this code Pin
Nagy Vilmos15-May-09 4:09
professionalNagy Vilmos15-May-09 4:09 
GeneralRe: How can I optimize this code Pin
Luc Pattyn15-May-09 4:23
sitebuilderLuc Pattyn15-May-09 4:23 
GeneralRe: How can I optimize this code Pin
Nagy Vilmos15-May-09 4:27
professionalNagy Vilmos15-May-09 4:27 
GeneralRe: How can I optimize this code Pin
MumbleB15-May-09 23:28
MumbleB15-May-09 23:28 
GeneralRe: How can I optimize this code Pin
Luc Pattyn16-May-09 1:08
sitebuilderLuc Pattyn16-May-09 1:08 
GeneralRe: How can I optimize this code Pin
MumbleB16-May-09 5:55
MumbleB16-May-09 5:55 
GeneralRe: How can I optimize this code Pin
Luc Pattyn16-May-09 6:54
sitebuilderLuc Pattyn16-May-09 6:54 
GeneralRe: How can I optimize this code Pin
MumbleB17-May-09 22:32
MumbleB17-May-09 22:32 
GeneralRe: How can I optimize this code Pin
Luc Pattyn18-May-09 0:37
sitebuilderLuc Pattyn18-May-09 0:37 
GeneralRe: How can I optimize this code Pin
MumbleB18-May-09 7:11
MumbleB18-May-09 7:11 
GeneralRe: How can I optimize this code Pin
Luc Pattyn18-May-09 7:30
sitebuilderLuc Pattyn18-May-09 7:30 
GeneralRe: How can I optimize this code Pin
MumbleB18-May-09 20:17
MumbleB18-May-09 20:17 

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.