总结一个数组的元素 [英] summing the elements of the an array

查看:54
本文介绍了总结一个数组的元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




任何机构都可以给我一个总结

数组元素的语法,而不需要循环


谢谢

Hi

Can any body give me the syntax for summing the elements of the an
array , without looping

thanks

推荐答案

我不确定你在找什么。更改数组单元格的值时,可以更新已计算的

总和。这是你的意思吗?或者

你的意思是使用ForEach方法(这是你的代码调用方法

为你做循环)。


请更具体地说明你要做的事情(一般答案是

,你必须明确地或暗示地循环)或者你是什么

试图解决(你目前的计算太慢了?)


" neeraj" < ne ******** @gmail.comaécritdansle message de news:
11 ******** @ a75g2000cwd.googlegroups。 com ...
I''m not sure what you are looking for. You could update an already computed
sum when you change the value of an array cell. Is this what you meant ? Or
do you meant using the ForEach method (that is your code calls the method
that does the looping for you).

Please be more specific in what you are trying to do (the general answer is
that you have to loop either explicitely or implicitely) or what you are
trying to solve (your current computation is too slow ?)

"neeraj" <ne********@gmail.coma écrit dans le message de news:
11**********************@a75g2000cwd.googlegroups. com...




任何机构都可以给我总结元素的语法一个

数组,没有循环


谢谢
Hi

Can any body give me the syntax for summing the elements of the an
array , without looping

thanks



I你做不到的事。如果你不想做任何循环,那么

也许你可以使用DataTable而不是数组并使用它'

..Compute()方法。你有什么理由不想做一个循环吗?


谢谢,


Seth Rowe

neeraj写道:
I don''t thing you can. If you don''t want to do any looping, then
perhaps you could use a DataTable instead of an array and use it''s
..Compute() method. Is there a reason you don''t want to do a loop?

Thanks,

Seth Rowe
neeraj wrote:




任何机构都可以给我一个总结元素的语法

数组,没有循环


谢谢
Hi

Can any body give me the syntax for summing the elements of the an
array , without looping

thanks


是的,当然:)


Dim values()As Integer = {1,2,3}

Dim sum As Integer = values(0)+ values(1)+ values(2)


:))


Serge
http://www.sergejusz.com


neeraj写道:
Yes, of course :)

Dim values() As Integer = {1, 2, 3}
Dim sum As Integer = values(0) + values(1) + values(2)

:))

Serge
http://www.sergejusz.com

neeraj wrote:

Hi


任何机构都可以给我一个总结

数组元素的语法,而无需循环


谢谢
Hi

Can any body give me the syntax for summing the elements of the an
array , without looping

thanks


这篇关于总结一个数组的元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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