Click here to Skip to main content
15,896,201 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
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();
Posted
Updated 3-Aug-17 0:51am
Comments
F-ES Sitecore 3-Aug-17 6:50am    
What's the error? And have you tried ".ToList()" and not ".List()"
GrpSMK 3-Aug-17 8:21am    
no not working
Richard Deeming 3-Aug-17 10:24am    
If you want someone to help you fix an exception, then you need to give us the full exception details.

Just saying "getting exception get inumerator like that" is not enough information for anyone to help you. We need the full exception details.

You also need to tell us which library you're using. Based on the class names, I'm assuming it's Stripe.NET[^]?

1 solution

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.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900