PropertyDescriptor 类
来源:互联网 发布:苹果最新下载软件 编辑:程序博客网 时间:2024/06/05 13:32
提供类上的属性的抽象化。
命名空间:System.ComponentModel
程序集:System(在 system.dll 中)
语法
[ComVisibleAttribute(true)] public abstract class PropertyDescriptor : MemberDescriptor
/** @attribute ComVisibleAttribute(true) */ public abstract class PropertyDescriptor extends MemberDescriptor
ComVisibleAttribute(true) public abstract class PropertyDescriptor extends MemberDescriptor
备注
属性的说明由名称、其特性、与该属性关联的组件类和该属性的类型组成。
PropertyDescriptor 提供以下属性和方法:
Converter 包含此属性的 TypeConverter。
IsLocalizable 指示该属性是否应该本地化。
GetEditor 返回指定类型的编辑器。
PropertyDescriptor 还提供以下 abstract 属性和方法:
ComponentType 包含该属性绑定到的组件的类型。
IsReadOnly 指示该属性是否是只读的。
PropertyType 获取属性的类型。
CanResetValue 指示重置组件是否会更改该组件的值。
GetValue 返回组件上属性的当前值。
ResetValue 重置组件属性的值。
SetValue 将组件的值设置为一个不同的值。
ShouldSerializeValue 指示是否需要持久保存该属性的值。
通常,abstract 成员是通过反射实现的。有关反射的更多信息,请参见 反射 中的主题。
应用于此类的 HostProtectionAttribute 属性 (Attribute) 具有以下 Resources 属性 (Property) 值:SharedState。HostProtectionAttribute 不影响桌面应用程序(桌面应用程序一般通过双击图标,键入命令或在浏览器中输入 URL 启动)。有关更多信息,请参见 HostProtectionAttribute 类或 SQL Server 编程和宿主保护属性。
示例
下面的代码示例是基于 PropertyDescriptorCollection 类中的示例生成的。该示例输出文本框中某个按钮的文本信息(类别、说明、显示名称)。它假定已在窗体上实例化 button1 和 textbox1。
// Creates a new collection and assign it the properties for button1.PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(button1);// Sets an PropertyDescriptor to the specific property.System.ComponentModel.PropertyDescriptor myProperty = properties.Find("Text", false);// Prints the property and the property description.textBox1.Text = myProperty.DisplayName+ '\n' ;textBox1.Text += myProperty.Description + '\n';textBox1.Text += myProperty.Category + '\n';
// Creates a new collection and assign it the properties for button1.PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(button1);// Sets an PropertyDescriptor to the specific property.System.ComponentModel.PropertyDescriptor myProperty = properties.Find("Text", false);// Prints the property and the property description.textBox1.set_Text(myProperty.get_DisplayName() + 'n');textBox1.set_Text(textBox1.get_Text() + myProperty.get_Description() + '\n');textBox1.set_Text(textBox1.get_Text() + myProperty.get_Category() + '\n');
继承层次结构
System.ComponentModel.MemberDescriptor
System.ComponentModel.PropertyDescriptor
System.ComponentModel.TypeConverter.SimplePropertyDescriptor
线程安全
平台
Windows 98、Windows 2000 SP4、Windows CE、Windows Millennium Edition、Windows Mobile for Pocket PC、Windows Mobile for Smartphone、Windows Server 2003、Windows XP Media Center Edition、Windows XP Professional x64 Edition、Windows XP SP2、Windows XP Starter Edition
.NET Framework 并不是对每个平台的所有版本都提供支持。有关受支持版本的列表,请参见系统要求。
版本信息
.NET Framework
受以下版本支持:2.0、1.1、1.0.NET Compact Framework
受以下版本支持:2.0、1.0请参见
参考
PropertyDescriptor 成员System.ComponentModel 命名空间
MemberDescriptor 类
Attribute
DefaultValueAttribute 类
- PropertyDescriptor 类
- PropertyDescriptor类 初接触
- PropertyDescriptor
- 内省、JavaBean、PropertyDescriptor类、Introspector类、BeanUtils工具包
- PropertyDescriptor 详解
- 黑马程序员--Java基础加强--10.【PropertyDescriptor操作JavaBean VS 反射操作Java类】【个人总结】
- Java使用PropertyDescriptor获取实体类中私有属性的值,并给私有属性赋值
- PropertyDescriptor的使用
- JavaAPI之PropertyDescriptor
- propertyDescriptor.getReadMethod笔记
- Java中PropertyDescriptor用法
- 内省、JavaBean、PropertyDescriptor类、Introspector类、BeanUtils工具包、注解、Rentention、Target、注解的基本属性和高级
- 内省、JavaBean、PropertyDescriptor类、Introspector类、BeanUtils工具包、注解、Rentention、Target、注解的基本属性和高级
- 内省、JavaBean、PropertyDescriptor类、Introspector类、BeanUtils工具包、注解、Rentention、Target、注解的基本属性和高级属性
- 内省、JavaBean、PropertyDescriptor类、Introspector类、BeanUtils工具包、注解、Rentention、Target、注解的基本属性和高级
- 内省、JavaBean、PropertyDescriptor类、Introspector类、BeanUtils工具包、注解、Rentention、Target、注解的基本属性和高级属性
- 内省、JavaBean、PropertyDescriptor类、Introspector类、BeanUtils工具包、注解、Rentention、Target、注解的基本属性和高级属性
- 内省、JavaBean、PropertyDescriptor类、Introspector类、BeanUtils工具包、注解、Rentention、Target、注解的基本属性和高级属性
- 多项式轨迹--五次多项式轨迹
- 杭电ACM OJ 1036 Average is not Fast Enough! 水的么简直就不谈了!(只是题目意思有点难理解)
- Javaweb-myeclipse开发Servlet的几点细节说明
- 摄氏和华氏的互相转换
- 为Python项目自动生成requirements.txt
- PropertyDescriptor 类
- SSM三大框架之Spring篇
- 单例模式
- 知道年月日求星期几
- ubuntu 16.04 安装完成之后的操作和设置 (一)
- Zookeeper--入门
- mac无法访问localhost
- 移动硬盘-移动硬盘提示格式化的解决办法
- Bootstrap——字体图标