回答編集履歴
2
コメントを受けて追記
test
CHANGED
@@ -89,3 +89,91 @@
|
|
89
89
|
|
90
90
|
|
91
91
|
```
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
----
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
2017年6月4日追記
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
コメントを受けての追記
|
106
|
+
|
107
|
+
だとしたら、以下のようになるかと
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
```csharp
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
using System;
|
116
|
+
|
117
|
+
using System.Collections.Generic;
|
118
|
+
|
119
|
+
using System.Linq;
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
namespace ConsoleApp2
|
124
|
+
|
125
|
+
{
|
126
|
+
|
127
|
+
internal class Program
|
128
|
+
|
129
|
+
{
|
130
|
+
|
131
|
+
private static void Main(string[] args)
|
132
|
+
|
133
|
+
{
|
134
|
+
|
135
|
+
var list = new List<List<string>>
|
136
|
+
|
137
|
+
{
|
138
|
+
|
139
|
+
new List<string> {"1", "2", "3", "4", "5"},
|
140
|
+
|
141
|
+
new List<string> {"", "", "", "", ""},
|
142
|
+
|
143
|
+
new List<string> {"1", "2", "3", "4", "5"}
|
144
|
+
|
145
|
+
};
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
//カウント出したいとき
|
152
|
+
|
153
|
+
var cnt = list.Count(x => x.All(y => y == ""));
|
154
|
+
|
155
|
+
Console.WriteLine(cnt);
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
//有無だけならこっちがオススメ
|
160
|
+
|
161
|
+
var result = list.Any(x => x.All(y => y == ""));
|
162
|
+
|
163
|
+
Console.WriteLine(result);
|
164
|
+
|
165
|
+
}
|
166
|
+
|
167
|
+
}
|
168
|
+
|
169
|
+
}
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
```
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
もし、カウントを有無の結果だけに使うならAny使った方が良いと思います。
|
1
たいぽ
test
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
[SelectMany](https://docs.microsoft.com/en-us/dotnet/api/system.linq.enumerable.selectmany--2?view=netframework-4.7)を使って、平
|
1
|
+
[SelectMany](https://docs.microsoft.com/en-us/dotnet/api/system.linq.enumerable.selectmany--2?view=netframework-4.7)を使って、平坦化した上でカウントするのが良いかと。。。
|
2
2
|
|
3
3
|
```csharp
|
4
4
|
|