c#查询内存中对象的两种类型之间的区别

c#查询内存中对象的两种类型之间的区别

本文介绍了c#查询内存中对象的两种类型之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,大家好。



我正在学习c#collections并找到一些LINQ检索查询,但无法理解我们必须在哪里使用iEnumeralbe以及我们可能在哪里不需要它,



如果有人给我以下两种类型的区别,对我来说会更进一步......感谢先生们...... br $>






int []整数= {1,9,5,3,7,2,11 ,23,50,41,6,8};

IEnmerable< int> takeWhileNumber = integers.TakeWhile(num =>

num.CompareTo(50)!= 0);









int [] takeWhileNumber;

int []整数= {1,9,5,3,7,2, 11,23,50,41,6,8};

takeWhileNumber = integers.TakeWhile(num =>

num.CompareTo(50)!= 0);

解决方案

Hi and Hello everybody,

I am learning c# collections and found some LINQ retrieving queries , but couldn't understand where we must use iEnumeralbe and where we may not need it,

if anybody gives me the difference of the following two types, would be greatful for me to move further... thanks in advance guys..



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




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

解决方案


这篇关于c#查询内存中对象的两种类型之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 02:23