HDI:创建对属性起作用的方法 [英] HDI: Create a method that acts on a property

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

问题描述

我想知道如何创建可用于属性的方法,就像comboBox1.Items.Add一样.我该怎么办?

I want to know how to create a method that can be used against a Property just like the comboBox1.Items.Add. How Do I?

推荐答案

我相信底层数据类型具有固有的功能,该数据类型是一个集合,并实现了包含Add()函数的ICollection接口. .通过使用实现ICollection接口的类,您将在公开该类实例的属性上具有Add()函数.
I believe the functionality there is inherent to the underlying data type, which is a collection and implements the ICollection interface which includes the Add() function. By using a class that implements the ICollection interface you will have the Add() function on properties that expose instances of that class.


这篇关于HDI:创建对属性起作用的方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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