如何使用此列表的每个循环? [英] How to to use for each loop for this list?

查看:138
本文介绍了如何使用此列表的每个循环?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想为每个循环使用获得一个计数值。



我尝试过:



从列表 paymentList 我想只得到一个计数,所以我想用于每个循环,但是对于每个循环都不起作用,得到异常得到这样的inumerator。

如果我使用下面也不工作

I want to use for each loop for get one count value.

What I have tried:

From the list paymentList i want to get only one count so i want to use for each loop but for each loop not working,getting exception get inumerator like that.
If i use like below also not working

IEnumerable<StripeCharge> response = chargeService.List();




var chargeService = new StripeChargeService();
                StripeList<StripeCharge> paymentList = chargeService.List();

推荐答案

这将取决于什么类型的数据 chargeService.List 返回 - 我们不知道,因为我们无法看到您的屏幕,访问您的硬盘或阅读您的想法。



所以先看看方法签名,并查看它返回的内容。猜测 - 并且没有特定的错误消息,它可以是 - 它不返回可枚举的 StripeCharge 对象,但这取决于你找出答案。



当你知道它返回的是什么时,你可以声明一个变量来保存那个类型,它应该从那时开始工作。
It's going to depend on what type of data chargeService.List returns - and we have no idea, since we can't see your screen, access your HDD, or read your mind.

So start by looking at the method signature, and see what it returns. At a guess - and without the specific error message that is all is can be - It doesn't return an enumerable of StripeCharge objects, but that's up to you to find out.

When you know what it returns, you can declare a variable to hold that type and it should work from then on.


这篇关于如何使用此列表的每个循环?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆