在vb.net中动态创建属性 [英] Create a property dynamically in vb.net

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

问题描述

我有 其中我有一个名为' 名称'的属性。 结构内的其他属性 values 取决于  设置  此值,  任何方式 仅限  >第一个属性 设置 ?. 

i 创建实例 类,访问 此结构所有属性都可用。

解决方案

听起来你想做的事情最好通过类继承完成。



创建一个具有共同特征(如'Name')属性的基类,然后为每个替代属性集创建继承此类的类。 / BLOCKQUOTE>

I have an Structure in a Class where i have a property named 'Name'. and other properties values inside the structure depends of the set of this value, is there any way to make them publics only when this first property is Set ?.

When i create an instance of the class , and access to this structure all the properties are available.

解决方案

It sounds like what you want to do is best accomplished by class inheritance.

Create a base class with the common features (like the 'Name') property then create classes that inherit from this for each of your alternative sets of properties.


这篇关于在vb.net中动态创建属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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