Stroke.AddPropertyData(Guid, Object) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
将自定义属性添加到 Stroke 对象。
public:
void AddPropertyData(Guid propertyDataId, System::Object ^ propertyData);
public void AddPropertyData(Guid propertyDataId, object propertyData);
member this.AddPropertyData : Guid * obj -> unit
Public Sub AddPropertyData (propertyDataId As Guid, propertyData As Object)
参数
- propertyDataId
- Guid
属性的唯一标识符。
- propertyData
- Object
自定义属性的值。
propertyData必须属于这些数据类型的类型Char、、、、ByteInt16UInt16Int32UInt32Int64UInt64SingleDoubleDateTime或BooleanString数组,但Decimal不允许。 String
例外
该 propertyData 参数不是节中列出的 Parameters 允许数据类型之一。
示例
以下示例演示如何向对象添加自定义属性 Stroke 。
// Create a guid for the date/timestamp.
Guid dtGuid = new Guid("03457307-3475-3450-3035-640435034540");
DateTime now = DateTime.Now;
// Check whether the property is already saved
if (thisStroke.ContainsPropertyData(dtGuid))
{
// Check whether the existing property matches the current date/timestamp
DateTime oldDT = (DateTime)thisStroke.GetPropertyData(dtGuid);
if (oldDT != now)
{
// Update the current date and time
thisStroke.AddPropertyData(dtGuid, now);
}
}
' Create a guid for the date/timestamp.
Dim dtGuid As New Guid("03457307-3475-3450-3035-640435034540")
Dim now As DateTime = DateTime.Now
' Check whether the property is already saved
If thisStroke.ContainsPropertyData(dtGuid) Then
' Check whether the existing property matches the current date/timestamp
Dim oldDT As DateTime = CType(thisStroke.GetPropertyData(dtGuid), DateTime)
If oldDT <> now Then
' Update the current date and time
thisStroke.AddPropertyData(dtGuid, now)
End If
End If
注解
如果需要在 . 中 Stroke存储额外信息,此方法非常有用。