C# Interview Questions and Answers
<< Previous Question Next Question >>
 Question: 492 Page Views: 

How do you sum all elements from a List<int> data



Posted By: Avi Date: 14 October 2010 07:08:47 PM
 Answer:

int result = data.Sum();


Posted By: avibtech


Date: 14 October 2010 07:08:47 PM
Post a better Answer if you have
 
(Will show your Gravatar icon)  
  Country flag

Loading
Enter the text as shown in the image gQOcvE
Related Questions
C# : What will be the result of code?
int x = 3;
switch(x % 3)
{
 case 0:
 case 1:
  Console.WriteLine(x*2); break;
 default:
  Console.WriteLine(x); break;
}
C# : Write a code to copy file from path1 to path2 using FileStreams and BinaryReader, BinaryWriter

Write a code to copy file from path1 to path2 using FileStreams and BinaryReader, BinaryWriter

s1 = new FileStream(path1, FileMode.Open, FileAccess.Read); s2 = new FileStream(path2, FileMode.Crea....
Category: C# Date: 10/14/2010 8:00:46 PM
C# : How do you sum all elements from a List<int> data

How do you sum all elements from a List data

int result = data.Sum();
Category: C# Date: 10/14/2010 7:08:47 PM
C# : What will be result of this code:
class C1 
{ protected int A = 0;
  public virtual void B() { console.writeLine(A); }}
class C2 : C1 {public override void B() { Console.WriteLine(A+10); }}
static void Main(string[] args)
{
C1 c = new C2();
c.B();
}
C# : How do you serialize an object using BinnaryFormater?

How do you serialize an object using BinnaryFormater?

FileStream fs = new FileStream(“file”, FileMode.Create); BinaryFormatter frm = new BinaryFormatter()....
Category: C# Date: 10/14/2010 5:13:46 PM