物品属性 [英] Items property

查看:75
本文介绍了物品属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么有些集合类,例如BindingList,还有其他类似的

不公开它们的Items属性?它是作为受保护的财产,所以为什么

不公开?


我可以解决这个问题,但必须有一个设计理由,这是什么是吗?


--guy--

解决方案

" guy" < gu*@discussions.microsoft.com> schrieb

为什么有些集合类,比如BindingList,但是其他的
也不暴露他们的Items属性?它是作为一个受保护的财产,所以为什么不把它公之于众?

我可以解决这个问题,但必须有一个设计理由,这是什么?
它是什么? / blockquote>

BindingList:搜索未找到结果

System.Windows.Forms.BindingsCollection.Item,如果你的意思是公开的。

Armin


嗨Armin,

我的想法是你无法做到

对于myBindingList.Items中的每个对象


你需要做类似的事情

对于i = 1到myBindingList .Count

thing = myBindingList.Item(i)


i只是想知道为什么它是这样设计的


欢呼


家伙


" Armin Zingler"写道:

" guy" < gu*@discussions.microsoft.com> schrieb

为什么有些集合类,比如BindingList,但是其他的
也不暴露他们的Items属性?它是作为一个受保护的财产,所以为什么不把它公之于众?

我可以解决这个问题,但必须有一个设计理由,这是什么?
它是什么? / blockquote>

BindingList:搜索未找到结果

System.Windows.Forms.BindingsCollection.Item,如果你的意思是公开的话。

Armin



抱歉Armin我应该说清楚,我使用的是vb2005,它是

我引用的System.ComponentModel.BindingList


" Armin Zingler"写道:

" guy" < gu*@discussions.microsoft.com> schrieb

为什么有些集合类,比如BindingList,但是其他的
也不暴露他们的Items属性?它是作为一个受保护的财产,所以为什么不把它公之于众?

我可以解决这个问题,但必须有一个设计理由,这是什么?
它是什么? / blockquote>

BindingList:搜索未找到结果

System.Windows.Forms.BindingsCollection.Item,如果你的意思是公开的话。

Armin



why is it that some collection classes, eg BindingList, but others as well do
not expose their Items property? It is there as a Protected property so why
not make it public?

I can work around this but there must be a design reason for this, what is it?

--guy--

解决方案

"guy" <gu*@discussions.microsoft.com> schrieb

why is it that some collection classes, eg BindingList, but others
as well do not expose their Items property? It is there as a
Protected property so why not make it public?

I can work around this but there must be a design reason for this,
what is it?


BindingList: "Search found no results"

System.Windows.Forms.BindingsCollection.Item, if you mean that, is public.
Armin


Hi Armin,
my thought was that you cant do a

For Each thing as Object in myBindingList.Items

you have to do something like

For i=1 to myBindingList.Count
thing=myBindingList.Item(i)

i just wondered why it was designed this way

cheers

guy

"Armin Zingler" wrote:

"guy" <gu*@discussions.microsoft.com> schrieb

why is it that some collection classes, eg BindingList, but others
as well do not expose their Items property? It is there as a
Protected property so why not make it public?

I can work around this but there must be a design reason for this,
what is it?


BindingList: "Search found no results"

System.Windows.Forms.BindingsCollection.Item, if you mean that, is public.
Armin



sorry Armin i should have made it clear, i am using vb2005, and it is the
System.ComponentModel.BindingList that i am refering to

"Armin Zingler" wrote:

"guy" <gu*@discussions.microsoft.com> schrieb

why is it that some collection classes, eg BindingList, but others
as well do not expose their Items property? It is there as a
Protected property so why not make it public?

I can work around this but there must be a design reason for this,
what is it?


BindingList: "Search found no results"

System.Windows.Forms.BindingsCollection.Item, if you mean that, is public.
Armin



这篇关于物品属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆