我在我的 foreach 语句中收到此错误。
foreach statement cannot operate on variables of type because does not contain a public definition for 'GetEnumerator'.
这是什么意思,我该如何解决?
更新
这是一些代码:
ServiceReference.TimereportResponseDto[] response;
foreach (ServiceReference.TimereportResponseDto r in response)
arbu.Text += r.Message + " " + r.Id + Environment.NewLine;
将[ ]添加到第一个精简版,现在我收到另一个错误:
Use of unassigned local variable 'response'
更新 2
我有这个文档示例,它看起来像这样:
Gateway.TimereportResponseDto[] response = theGate.CreateTimereport(timeReport);
foreach (Gateway.TimereportResponseDto r in response)
textBoxLog.Text += r.Message + " " + r.Id + Environment.NewLine;