Stroke.AddPropertyData(Guid, Object) Metod
Definition
Viktigt
En del information gäller för förhandsversionen av en produkt och kan komma att ändras avsevärt innan produkten blir allmänt tillgänglig. Microsoft lämnar inga garantier, uttryckliga eller underförstådda, avseende informationen som visas här.
Lägger till en anpassad egenskap i Stroke objektet.
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)
Parametrar
- propertyDataId
- Guid
Den unika identifieraren för egenskapen.
- propertyData
- Object
Värdet för den anpassade egenskapen.
propertyDatamåste vara av typen Char, Byte, Int16, UInt16, Int32, UInt32, Int64, UInt64Single, , Double, DateTime, Boolean, , StringDecimaleller en matris med dessa datatyper, förutom String, som inte är tillåten.
Undantag
Argumentet propertyData är inte en av de tillåtna datatyper som anges i Parameters avsnittet.
Exempel
I följande exempel visas hur du lägger till en anpassad egenskap i ett Stroke objekt.
// 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
Kommentarer
Den här metoden är användbar om du behöver lagra extra information i Stroke.