Click here to Skip to main content
15,895,011 members
Home / Discussions / C#
   

C#

 
AnswerRe: Storing 2 bytes in one Pin
PIEBALDconsult22-Dec-09 10:28
mvePIEBALDconsult22-Dec-09 10:28 
GeneralRe: Storing 2 bytes in one Pin
Luc Pattyn22-Dec-09 12:00
sitebuilderLuc Pattyn22-Dec-09 12:00 
AnswerRe: Storing 2 bytes in one Pin
J4amieC22-Dec-09 21:33
J4amieC22-Dec-09 21:33 
AnswerRe: Storing 2 bytes in one Pin
vtchris-peterson23-Dec-09 7:26
vtchris-peterson23-Dec-09 7:26 
Questionproblem with list view selection. Pin
santhosh-padamatinti22-Dec-09 5:20
santhosh-padamatinti22-Dec-09 5:20 
AnswerRe: problem with list view selection. Pin
EddieRich22-Dec-09 5:37
EddieRich22-Dec-09 5:37 
QuestionWebparts Pin
NETLearning22-Dec-09 5:06
NETLearning22-Dec-09 5:06 
QuestionC# / LINQ Directory.GetFiles Pin
Wheels01222-Dec-09 3:37
Wheels01222-Dec-09 3:37 
Good morning.

I just started using Directory.GetFiles and I am wondering why it returns the path including the file name. It is my expectation that it would only return a list of file names as I already know the path.

I have the follwoing code:
internal static void DemoGrouping()
        {
            string[] files = Directory.GetFiles(@"C:\Documents and Settings\TEMP");

            //Convention: Name method so that it explains what the query is doing
            var fileList = from file in files
                           where file.Length > 1
                           orderby file.Length                       
                           group file by file.Length;


            foreach (var group in fileList)
            {
                //First print the group
               Console.WriteLine(group.Key);
                foreach (string subgroup in group)
                Console.WriteLine("   " + subgroup);
            }


        }


Without getting into substrings to extract the file name, is there a usage of Directory.GetFiles that accomplishes what I am looking for?

Thank you, WHEELS
AnswerRe: C# / LINQ Directory.GetFiles Pin
Rob Philpott22-Dec-09 3:51
Rob Philpott22-Dec-09 3:51 
AnswerRe: C# / LINQ Directory.GetFiles Pin
#realJSOP22-Dec-09 3:53
mve#realJSOP22-Dec-09 3:53 
AnswerRe: C# / LINQ Directory.GetFiles Pin
Luc Pattyn22-Dec-09 6:26
sitebuilderLuc Pattyn22-Dec-09 6:26 
GeneralRe: C# / LINQ Directory.GetFiles Pin
Wheels01222-Dec-09 6:32
Wheels01222-Dec-09 6:32 
QuestionFile copy progress Pin
Samarchpa22-Dec-09 3:21
Samarchpa22-Dec-09 3:21 
AnswerRe: File copy progress Pin
Rob Philpott22-Dec-09 3:53
Rob Philpott22-Dec-09 3:53 
GeneralRe: File copy progress Pin
Samarchpa22-Dec-09 4:11
Samarchpa22-Dec-09 4:11 
GeneralRe: File copy progress Pin
#realJSOP22-Dec-09 4:29
mve#realJSOP22-Dec-09 4:29 
GeneralRe: File copy progress Pin
Samarchpa22-Dec-09 5:25
Samarchpa22-Dec-09 5:25 
GeneralRe: File copy progress Pin
Saksida Bojan22-Dec-09 5:38
Saksida Bojan22-Dec-09 5:38 
GeneralRe: File copy progress Pin
J4amieC22-Dec-09 5:52
J4amieC22-Dec-09 5:52 
GeneralRe: File copy progress Pin
#realJSOP23-Dec-09 2:07
mve#realJSOP23-Dec-09 2:07 
GeneralRe: File copy progress Pin
Samarchpa23-Dec-09 4:47
Samarchpa23-Dec-09 4:47 
AnswerRe: File copy progress Pin
Luc Pattyn22-Dec-09 6:33
sitebuilderLuc Pattyn22-Dec-09 6:33 
QuestionCannot create ActiveX component instance Pin
dataminers22-Dec-09 1:44
dataminers22-Dec-09 1:44 
AnswerRe: Cannot create ActiveX component instance Pin
Luc Pattyn22-Dec-09 3:18
sitebuilderLuc Pattyn22-Dec-09 3:18 
AnswerRe: Cannot create ActiveX component instance Pin
Dave Kreskowiak22-Dec-09 3:54
mveDave Kreskowiak22-Dec-09 3:54 

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.