问题标签 [ilist]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
3 回答
3226 浏览

c# - 在 IList 中使用 Type.GetType(string)

由于我无法对此帖子发表任何评论(仅发布答案),因此将发布一个新问题。
我按照上述帖子中的说明进行操作,但代码会产生错误。
编码:

错误:

使用泛型类型“System.Collections.Generic.IList”需要“1”类型参数

显然,我不能只说IList没有任何类型,所以我想知道上述帖子的答案究竟是如何工作的。

提前致谢。

0 投票
2 回答
220 浏览

delegates - 通用委托和 IList

我想为冒泡排序实现一个委托解决方案。我有这个代码:

冒泡排序函数签名是:

我收到此错误:

参数“2”:无法从“方法组”转换为“DelegatesAndGenerics.SortHandler”

0 投票
2 回答
347 浏览

ienumerable - Choosing the right Collection/List for my repository

I have a repository:

I am wondering if it is better to return an IList or IEnumerable (instead of an ObservableCollection) from my repository since my viewmodel may end up putting it in either an ObservableCollection or List, depending on my need. For instance, I may return data from the repository above to a read-only datagrid or dropdown list, or I may want the same data in an editable datagrid.

I am thinking (and could be wrong) that I want my repository to return a barebones list, then convert it to what suites my needs in the viewmodel. Is my thinking correct? Here is what I was thinking:

Thanks.

0 投票
3 回答
41722 浏览

c# - 我应该使用什么 IEnumerable 或 IList?

谁能告诉我什么时候应该使用。

例如,当我想访问集合或单个项目的 .Count 时,我认为应该使用 IList,对吗?

谢谢你。

0 投票
3 回答
1165 浏览

c# - 创建 IList<> 类型的类字段?

我正在尝试创建一个名为 Friend.cs 的 POCO 对象。我似乎无法为 IList 创建内联属性。

谢谢您的帮助!

0 投票
5 回答
4229 浏览

c# - 列表没有“哪里”

在我工作的一个特定项目中,我有一个返回 IList 的方法。但是这个接口不包含 where 或 FindAll 过滤器。但是,当我打开一个新项目时,IList 包含所有内容。有什么区别?

0 投票
1 回答
6280 浏览

c# - 将绑定源数据源设置为通用 IList<> 错误

如果我想将 BindingSource 上的 DataSource 属性设置为 IList<>,我是否需要显式转换,如以下错误消息所述,还是我做错了什么?

订单项.cs

无法将类型“System.Windows.Forms.BindingSource”隐式转换为“System.Collections.Generic.IList”。存在显式转换(您是否缺少演员表?)

0 投票
1 回答
3977 浏览

vb.net - VB.Net - 我如何获取列表中包含的对象的类型

如果我有清单...

我想获取列表中包含的对象的类型,我该怎么做?

显而易见的答案,从我的实际实现中似乎是不可能的,就是做这样的事情......

但是如果列表是空的并且我仍然想知道它包含的类型怎么办?

0 投票
2 回答
2100 浏览

c# - C#,ArrayList 属性到列表字段

我有以下领域:

和以下属性:

get 完美运行,因为我有另一个用于不同目的的直接属性。但是该设置不起作用,因为当我使用此属性时,它不会更新任何内容。调试表明该属性是一个空的 ArrayList(计数 0)并且该字段保持为空。知道为什么这不起作用吗?任何帮助将不胜感激。

0 投票
7 回答
1976 浏览

c# - 删除 foreach - c# 代码优化

如何优化这段代码?

ParentDoglist,ChildDoglistis - Ilist。dogListBox - 列表框

编辑: ParentDogTypeList、DogTypeList 被重命名为 ParentDoglist、ChildDoglist,两者互不相关

改为

完整故事:

我需要填充一个下拉菜单,它会回报父子关系。有些狗可能没有孩子,被称为叶狗。我还需要显示该特定类别中的狗数量

DD 看起来像

因此,ParentDoglist 会将所有子元素和叶子元素与计数一起带来,而 ChildDogList 将具有父元素和叶子 ID,因此我将能够将相应的子元素填充到它们的父元素并直接绑定叶子。

Parent、Child 和 Leaf Dog 将保存在一个表中,并通过 statusid 进行区分,而 count 将在另一个表中。

没有父母有任何计数,只有孩子和叶子有计数

表架构:

替代文字