Click here to Skip to main content
15,909,747 members
Home / Discussions / C#
   

C#

 
GeneralRe: Designing: Multiple interfaces implementation on classes Pin
vinayvraman9-Nov-11 3:58
vinayvraman9-Nov-11 3:58 
AnswerRe: Designing: Multiple interfaces implementation on classes Pin
BillWoodruff10-Nov-11 5:49
professionalBillWoodruff10-Nov-11 5:49 
QuestionHow to Sleep a Thread? Pin
namelkcip8-Nov-11 16:46
namelkcip8-Nov-11 16:46 
AnswerRe: How to Sleep a Thread? Pin
lukeer8-Nov-11 22:00
lukeer8-Nov-11 22:00 
GeneralRe: How to Sleep a Thread? Pin
namelkcip10-Nov-11 4:40
namelkcip10-Nov-11 4:40 
GeneralRe: How to Sleep a Thread? Pin
lukeer10-Nov-11 21:04
lukeer10-Nov-11 21:04 
AnswerRe: How to Sleep a Thread? Pin
BobJanova8-Nov-11 23:19
BobJanova8-Nov-11 23:19 
QuestionWhat am I doing wrong? Pin
Member 83630848-Nov-11 15:33
Member 83630848-Nov-11 15:33 
The first code works, however I need to be able to read contents of multiple files from a particular directory.

Start simple and build from there I figure. Doing something wrong somewhere, as the 2nd code only brings up the dos window without any data.

C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace readtest
{
    class Program
    {
        static void Main(string[] args)
        {
           
           
            StreamReader sr = new StreamReader("C:\\Users\\Random.txt");
                string str = sr.ReadLine();
                
                string[] words = str.Split('|');
                foreach (string word in words)
                {
                    Console.WriteLine(word);
                } Console.ReadKey();
            }
        }
    }


This is the one I need to have working. I must be structuring something wrong. I've tried different ways, but no luck.

C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] files = Directory.GetFiles("C:\\Users", ".txt");
            foreach (string file in files)
            {
                StreamReader sr = new StreamReader(file);
                string str = sr.ReadLine();

                    {
                        Console.WriteLine(file);
                    }
                } Console.ReadKey();

            }
        }
    }

AnswerRe: What am I doing wrong? Pin
Hum Dum8-Nov-11 17:09
Hum Dum8-Nov-11 17:09 
AnswerRe: What am I doing wrong? Pin
RobCroll8-Nov-11 17:09
RobCroll8-Nov-11 17:09 
QuestionAce OLE driver with Extended Properties Pin
Alaric_8-Nov-11 10:18
professionalAlaric_8-Nov-11 10:18 
AnswerRe: Ace OLE driver with Extended Properties Pin
Dave Kreskowiak8-Nov-11 13:28
mveDave Kreskowiak8-Nov-11 13:28 
GeneralRe: Ace OLE driver with Extended Properties Pin
Alaric_15-Nov-11 9:59
professionalAlaric_15-Nov-11 9:59 
QuestionRemoving Mutex and file lock using DLL injection (Guild Wars) in C# Pin
KairuByte8-Nov-11 8:06
KairuByte8-Nov-11 8:06 
GeneralRe: Removing Mutex and file lock using DLL injection (Guild Wars) in C# Pin
harold aptroot8-Nov-11 8:37
harold aptroot8-Nov-11 8:37 
GeneralRe: Removing Mutex and file lock using DLL injection (Guild Wars) in C# Pin
KairuByte8-Nov-11 8:50
KairuByte8-Nov-11 8:50 
GeneralRe: Removing Mutex and file lock using DLL injection (Guild Wars) in C# Pin
harold aptroot8-Nov-11 9:01
harold aptroot8-Nov-11 9:01 
GeneralRe: Removing Mutex and file lock using DLL injection (Guild Wars) in C# Pin
KairuByte8-Nov-11 9:06
KairuByte8-Nov-11 9:06 
GeneralRe: Removing Mutex and file lock using DLL injection (Guild Wars) in C# Pin
harold aptroot8-Nov-11 9:10
harold aptroot8-Nov-11 9:10 
GeneralRe: Removing Mutex and file lock using DLL injection (Guild Wars) in C# Pin
KairuByte8-Nov-11 9:16
KairuByte8-Nov-11 9:16 
GeneralRe: Removing Mutex and file lock using DLL injection (Guild Wars) in C# Pin
harold aptroot8-Nov-11 9:20
harold aptroot8-Nov-11 9:20 
GeneralRe: Removing Mutex and file lock using DLL injection (Guild Wars) in C# Pin
KairuByte8-Nov-11 9:26
KairuByte8-Nov-11 9:26 
GeneralRe: Removing Mutex and file lock using DLL injection (Guild Wars) in C# Pin
harold aptroot8-Nov-11 9:36
harold aptroot8-Nov-11 9:36 
GeneralRe: Removing Mutex and file lock using DLL injection (Guild Wars) in C# Pin
KairuByte8-Nov-11 9:40
KairuByte8-Nov-11 9:40 
GeneralRe: Removing Mutex and file lock using DLL injection (Guild Wars) in C# Pin
harold aptroot8-Nov-11 9:45
harold aptroot8-Nov-11 9:45 

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.