回答編集履歴
2
typo
answer
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
```C#
|
5
5
|
private void DoImportFiles(string[] xlsxfiles)
|
6
6
|
{
|
7
|
-
foreach (string xlsxfile in xlsxfiles.OrderBy(v => v.Substring(
|
7
|
+
foreach (string xlsxfile in xlsxfiles.OrderBy(v => v.Substring(v.Length - 8))
|
8
8
|
{
|
9
9
|
// 1ファイルづつ処理する
|
10
10
|
DoImportFile(xlsxfile);
|
1
文字抜き出しについて追記
answer
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
`LINQ`の`OrderBy`が真っ先に思い浮かびました。
|
2
|
+
ファイルの日付が8文字固定であれば`Substring`メソッドで抜き出してしまえば良いかと。
|
2
3
|
|
3
4
|
```C#
|
4
5
|
private void DoImportFiles(string[] xlsxfiles)
|
5
6
|
{
|
6
|
-
foreach (string xlsxfile in xlsxfiles.OrderBy(v => v))
|
7
|
+
foreach (string xlsxfile in xlsxfiles.OrderBy(v => v.Substring(a.Length - 8))
|
7
8
|
{
|
8
9
|
// 1ファイルづつ処理する
|
9
10
|
DoImportFile(xlsxfile);
|