add together values in collection

J

Jeff

ASP.NET 2.0

In my webproject I got a class named "Tag".This class contains a variable
named "Weight" of datatype int...

This is a generic list (I assume it is a generic list) of Tag objects
List<Tag> tags = new List<Tag>();

PROBLEM:
I want to add together all the Weight values in the list

I know I could do this in a loop, for example a foreach loop. But I'm
wondering if this could be done without a loop.. Maybe the Generic feature
in .NET 2.0 has some nice feature for this?

(( I have no problem using a loop here, I just ask just in case there is a
smarter way of doing it ))

Any suggestions?

Jeff
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top