如何在数据集中的每第10行调用一个方法 [英] How to call a method on every 10th row in a dataset

查看:58
本文介绍了如何在数据集中的每第10行调用一个方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我想知道这是否可行。我想为数据集中的每10个项目调用一个特定的函数。



例如:



1,2,3,4,5,6,7,8,9,10,(呼叫功能),11,12,13,14,15,16,17,18,19,20,(呼叫功能) )



这可能吗?这可能是一段非常简单的代码,但我似乎无法弄明白。



问候,

克里斯

Hi All,

I'm wondering if this is possible. I want to have a specific function be called for every 10th item in the dataset.

For example:

1, 2, 3, 4, 5, 6, 7, 8, 9, 10, (Call Function), 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, (Call Function)

Is this possible? This is probably a very simple piece of code, but I cannot seem to figure it out.

Regards,
Chris

推荐答案

尝试了什么?



这与数据集或c#无关。这是基本的算术。



无论如何,你可以开始这样的事情:



Tried anything?

It has nothing to do with dataset or c# for that matter. It's basic arithmetic.

Anyway, you can start something like this:

for (int count = 1; count <= 100; count++)
{
    if((count % 10) == 0)
    {
        Console.WriteLine(count);

        //Call your function here...
    }
}


这篇关于如何在数据集中的每第10行调用一个方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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