小弟看不懂一段程序:[Bindable(true)]
public int MyProperty {
get {
// Insert code here.
return 0;
}
set {
// Insert code here.
}
}指定这个属性用于绑定,
可本人不懂这个属性绑定与不绑定有什么区别,,,
请好心有解译一下!
public int MyProperty {
get {
// Insert code here.
return 0;
}
set {
// Insert code here.
}
}指定这个属性用于绑定,
可本人不懂这个属性绑定与不绑定有什么区别,,,
请好心有解译一下!
解决方案 »
- C# 已经实现模拟登录(可以获得登录后的html),怎样实现打开一个登录后的页面
- 关于地址解码和编码的技术问题
- 字符串转换
- .net中当关闭子窗体后怎样关闭父窗体
- C# ThreadException 和 UnhandledException的区别?
- 问一个小白问题……pictureBox不能画东西……
- 一个按钮点击事件里调用了一个新线程,新线程调用了一个process,怎么判断这个进程执行完毕啊?
- 求一SQL语句????????????????????????????????????????
- C#调用C++编写的dll指针的应用
- 有人了解类似Microsoft Windows Update更新客户端应用程序的方法吗?
- 这几天脑子进水,关于怎么把webform.aspx.cs文件编译.dll的问题?
- 请大家帮忙解决一个反射的问题
是不是这个意思:
class.MyProperty=数据源:
有关此类型所有成员的列表,请参阅 BindableAttribute 成员。
System.Object
System.Attribute
System.ComponentModel.BindableAttribute
[Visual Basic]
<AttributeUsage(AttributeTargets.All)>
NotInheritable Public Class BindableAttribute
Inherits Attribute
[C#]
[AttributeUsage(AttributeTargets.All)]
public sealed class BindableAttribute : Attribute
[C++]
[AttributeUsage(AttributeTargets::All)]
public __gc __sealed class BindableAttribute : public Attribute
[JScript]
public
AttributeUsage(AttributeTargets.All)
class BindableAttribute extends Attribute
线程安全
此类型的所有公共静态(Visual Basic 中为 Shared)成员对多线程操作而言都是安全的。但不保证任何实例成员是线程安全的。
备注
您可以为控件上的多个属性指定该特性。
用布尔值初始化 BindableAttribute 类的新实例。
如果使用值 true 的 BindableAttribute 构造函数标记属性,则应引发该属性的属性更改通知。这意味着如果 Bindable 是 Yes,则支持双向数据绑定。如果 Bindable 是 No,则您仍可以绑定到该属性,但它不应该显示在默认的要绑定到的属性集中,因为它不一定引发属性更改通知。
注意 当使用值 true 的 BindableAttribute 构造函数标记属性时,此特性的值被设置为常量成员 Yes。对于使用值 false 的 BindableAttribute 构造函数标记的属性,该值为 No。因此,若要在代码中检查该特性的值,必须将该特性指定为 BindableAttribute.Yes 或 BindableAttribute.No。
警告 您只能在设计时使用该特性。您在运行时可以随意向任何属性进行绑定。
有关更多信息,请参见特性概述和利用属性扩展元数据。
示例
[Visual Basic, C#, C++] 下面的示例将属性标记为适于将数据绑定到的属性。
[Visual Basic]
<Bindable(True)> _
Public Property MyProperty() As Integer
Get
' Insert code here.
Return 0
End Get
Set
' Insert code here.
End Set
End Property
[C#]
[Bindable(true)]
public int MyProperty {
get {
// Insert code here.
return 0;
}
set {
// Insert code here.
}
}