1
Reply

c# collection

Ask a question
Hi and hello everybody...
 
 I am beginner to the c# collections , i can't understand the exact need of iEnumerable's advantages, if anybody gives the difference between the following two type of codes, would be great thing for me to understand what i need,  thanks in advance guys...
 

Type1:
int[] integers = { 1, 9, 5, 3, 7, 2, 11, 23, 50, 41, 6, 8 };
IEnmerable<int> takeWhileNumber = integers.TakeWhile(num =>
num.CompareTo(50) != 0);



Type2:
int[] takeWhileNumber ;
int[] integers = { 1, 9, 5, 3, 7, 2, 11, 23, 50, 41, 6, 8 };
takeWhileNumber = integers.TakeWhile(num =>
num.CompareTo(50) != 0);

 
 
 
 

Answers (1)