草庐IT

ienumerator

全部标签

c# - 任何人都可以向我解释 IEnumerable 和 IEnumerator 吗?

关闭。这个问题需要更多focused.它目前不接受答案。想改进这个问题吗?更新问题,使其只关注一个问题editingthispost.关闭3年前。Improvethisquestion谁能给我解释一下IEnumerable和IEnumerator?例如,什么时候在foreach上使用它?IEnumerable和IEnumerator有什么区别?为什么我们需要使用它?

c# - 任何人都可以向我解释 IEnumerable 和 IEnumerator 吗?

关闭。这个问题需要更多focused.它目前不接受答案。想改进这个问题吗?更新问题,使其只关注一个问题editingthispost.关闭3年前。Improvethisquestion谁能给我解释一下IEnumerable和IEnumerator?例如,什么时候在foreach上使用它?IEnumerable和IEnumerator有什么区别?为什么我们需要使用它?

c# - 从 IList<string> 或 IEnumerable<string> 创建逗号分隔列表

从IList创建逗号分隔的字符串值列表的最简洁方法是什么?或IEnumerable?String.Join(...)在string[]上运行所以使用诸如IList之类的类型会很麻烦或IEnumerable不能轻易转换为字符串数组。 最佳答案 .NET4+IListstrings=newList{"1","2","testing"};stringjoined=string.Join(",",strings);详细信息和Pre.Net4.0解决方案IEnumerable可以使用LINQ(.NET3.5)非常轻松地转换为字符串数组:IEn

c# - 从 IList<string> 或 IEnumerable<string> 创建逗号分隔列表

从IList创建逗号分隔的字符串值列表的最简洁方法是什么?或IEnumerable?String.Join(...)在string[]上运行所以使用诸如IList之类的类型会很麻烦或IEnumerable不能轻易转换为字符串数组。 最佳答案 .NET4+IListstrings=newList{"1","2","testing"};stringjoined=string.Join(",",strings);详细信息和Pre.Net4.0解决方案IEnumerable可以使用LINQ(.NET3.5)非常轻松地转换为字符串数组:IEn

c# - 返回 IEnumerable<T> 与 IQueryable<T>

返回IQueryable有什么区别?与IEnumerable,什么时候应该优先选择一个?IQueryablecusts=fromcindb.Customerswherec.City==""selectc;IEnumerablecusts=fromcindb.Customerswherec.City==""selectc;两者都会被延迟执行吗?什么时候应该优先执行一个? 最佳答案 是的,两者都会给你deferredexecution.区别在于IQueryable是允许LINQ-to-SQL(实际上是LINQ.-to-anything)

c# - 返回 IEnumerable<T> 与 IQueryable<T>

返回IQueryable有什么区别?与IEnumerable,什么时候应该优先选择一个?IQueryablecusts=fromcindb.Customerswherec.City==""selectc;IEnumerablecusts=fromcindb.Customerswherec.City==""selectc;两者都会被延迟执行吗?什么时候应该优先执行一个? 最佳答案 是的,两者都会给你deferredexecution.区别在于IQueryable是允许LINQ-to-SQL(实际上是LINQ.-to-anything)

c# - 创建常量 IEnumerable<TSomeType>...的方法?

也许这是一个愚蠢的问题...但是创建常量IEnumerable的最佳(性能和内存方面)方法是什么?...?如果无法定义“最佳”方式,我有哪些选择?您的意见是什么,您认为有最合适的方法吗?例如:varenumerable=(IEnumerable)newList{Value1,Value2,Value3};varenumerable=(IEnumerable)newTSomeType[]{Value1,Value2,Value3};(其他一些选项;例如LinqSelect)。请考虑到内存和性能是这里的一个问题-我们谈论的是一个真正受限的环境(安装了.NET的小型设备)。提前致谢。

c# - 创建常量 IEnumerable<TSomeType>...的方法?

也许这是一个愚蠢的问题...但是创建常量IEnumerable的最佳(性能和内存方面)方法是什么?...?如果无法定义“最佳”方式,我有哪些选择?您的意见是什么,您认为有最合适的方法吗?例如:varenumerable=(IEnumerable)newList{Value1,Value2,Value3};varenumerable=(IEnumerable)newTSomeType[]{Value1,Value2,Value3};(其他一些选项;例如LinqSelect)。请考虑到内存和性能是这里的一个问题-我们谈论的是一个真正受限的环境(安装了.NET的小型设备)。提前致谢。

c# - 如何使用 SWIG 将 IEnumerable 作为参数的 C++ 委托(delegate)从 C# 创建传递?

所以我有下一个C++代码:#ifdefWIN32#undefCALLBACK#defineCALLBACK__stdcall#else#defineCALLBACK#endif#include#includenamespaceOdeProxy{typedefstd::vectorstate_type;typedefvoid(CALLBACK*System)(conststate_type&,state_type&,constdouble);typedefvoid(CALLBACK*Observer)(conststate_type&,double);classOde{public:st

c# - 如何使用 SWIG 将 IEnumerable 作为参数的 C++ 委托(delegate)从 C# 创建传递?

所以我有下一个C++代码:#ifdefWIN32#undefCALLBACK#defineCALLBACK__stdcall#else#defineCALLBACK#endif#include#includenamespaceOdeProxy{typedefstd::vectorstate_type;typedefvoid(CALLBACK*System)(conststate_type&,state_type&,constdouble);typedefvoid(CALLBACK*Observer)(conststate_type&,double);classOde{public:st