Click here to Skip to main content
15,299,443 members
Home / Discussions / C#
   

C#

 
AnswerRe: C# in vb.net in windows base application Pin
Richard MacCutchan6-Mar-13 22:30
mveRichard MacCutchan6-Mar-13 22:30 
QuestionMonitoring Applications and Processes Pin
mphill47446-Mar-13 10:37
Membermphill47446-Mar-13 10:37 
AnswerRe: Monitoring Applications and Processes Pin
Jim Meadors6-Mar-13 19:49
MemberJim Meadors6-Mar-13 19:49 
AnswerRe: Monitoring Applications and Processes Pin
Bernhard Hiller6-Mar-13 23:24
MemberBernhard Hiller6-Mar-13 23:24 
GeneralRe: Monitoring Applications and Processes Pin
mphill47447-Mar-13 5:25
Membermphill47447-Mar-13 5:25 
AnswerRe: Monitoring Applications and Processes Pin
jschell7-Mar-13 8:40
Memberjschell7-Mar-13 8:40 
Questionc# file directory structure change Pin
classy_dog6-Mar-13 10:19
Memberclassy_dog6-Mar-13 10:19 
AnswerRe: c# file directory structure change Pin
Matt T Heffron6-Mar-13 12:42
professionalMatt T Heffron6-Mar-13 12:42 
First to fix the Format_Date for the month as abbreviated name:
C#
string Format_Date = DateTime.Now.AddMonths(-1).ToString("_MMM_yyyy");

Next, to get all of the file information from all subdirectories, change the code to build RFiles to be:
C#
var RFiles = from path in Directory.EnumerateFiles(filesaveLocation, "*.*", SearchOption.AllDirectories)
               let extension = Path.GetExtension(path)
               where extension == ".pdf" || extension == ".xlsx" || extension == ".xls"
               select path;

It probably isn't necessary to make this into an array if you are just going to iterate over the collection in a foreach. This Linq query will return an IEnumerable<string> which can be used directly in the foreach (unless you will be modifying the values in the collection during the loop).
The string comparisons in the query will be case-sensitive, just like your use of .EndsWith(...).

Now, if all you are going to do is iterate over this collection of filepaths, why not skip building RFiles altogether:
C#
foreach (string RFile in Directory.EnumerateFiles(filesaveLocation, "*.*", SearchOption.AllDirectories))
{
  string extension = Path.GetExtension(RFile);
  if (extension == ".pdf" || extension == ".xlsx" || extension == ".xls")
  {
    //...
  }
}

GeneralRe: c# file directory structure change Pin
classy_dog6-Mar-13 18:50
Memberclassy_dog6-Mar-13 18:50 
GeneralRe: c# file directory structure change Pin
Matt T Heffron7-Mar-13 8:29
professionalMatt T Heffron7-Mar-13 8:29 
AnswerRe: c# file directory structure change Pin
Jegan Thiyagesan6-Mar-13 13:03
MemberJegan Thiyagesan6-Mar-13 13:03 
GeneralRe: c# file directory structure change Pin
classy_dog6-Mar-13 18:45
Memberclassy_dog6-Mar-13 18:45 
GeneralRe: c# file directory structure change Pin
Jegan Thiyagesan6-Mar-13 21:17
MemberJegan Thiyagesan6-Mar-13 21:17 
Questionpass Convert.ToDateTime to date in MysqlDataType Pin
Jassim Rahma6-Mar-13 2:21
MemberJassim Rahma6-Mar-13 2:21 
AnswerRe: pass Convert.ToDateTime to date in MysqlDataType Pin
Eddy Vluggen6-Mar-13 3:16
professionalEddy Vluggen6-Mar-13 3:16 
AnswerRe: pass Convert.ToDateTime to date in MysqlDataType Pin
OriginalGriff6-Mar-13 4:50
mveOriginalGriff6-Mar-13 4:50 
GeneralRe: pass Convert.ToDateTime to date in MysqlDataType Pin
Eddy Vluggen6-Mar-13 4:58
professionalEddy Vluggen6-Mar-13 4:58 
AnswerRe: pass Convert.ToDateTime to date in MysqlDataType Pin
Wayne Gaylard6-Mar-13 5:03
professionalWayne Gaylard6-Mar-13 5:03 
AnswerRe: pass Convert.ToDateTime to date in MysqlDataType Pin
jschell6-Mar-13 8:42
Memberjschell6-Mar-13 8:42 
Questionplz check my sql code. is it correct ? Pin
Member 103026305-Mar-13 22:38
MemberMember 103026305-Mar-13 22:38 
AnswerRe: plz check my sql code. is it correct ? Pin
Pete O'Hanlon5-Mar-13 22:41
mvaPete O'Hanlon5-Mar-13 22:41 
GeneralRe: plz check my sql code. is it correct ? Pin
Member 103026305-Mar-13 23:43
MemberMember 103026305-Mar-13 23:43 
GeneralRe: plz check my sql code. is it correct ? Pin
Pete O'Hanlon5-Mar-13 23:50
mvaPete O'Hanlon5-Mar-13 23:50 
AnswerRe: plz check my sql code. is it correct ? Pin
PIEBALDconsult6-Mar-13 16:55
professionalPIEBALDconsult6-Mar-13 16:55 
GeneralRe: plz check my sql code. is it correct ? Pin
Member 1030263012-Mar-13 19:15
MemberMember 1030263012-Mar-13 19:15 

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.