AGI STK Objects 11Send comments on this topic.
Metadata Property (IAgStkObject)
See Also  Example
Windows






Windows & Linux

Description

Gets the object's metadata. Metadata is a collection of keys and their associated values.

Property type

Read-only property

Syntax

[Visual Basic .NET]
Public Property Metadata() As IAgKeyValueCollection
[C#]
public IAgKeyValueCollection Metadata {get;}
[Managed C++]
public: __property IAgKeyValueCollection^ get_Metadata();
[Unmanaged C++]
public: HRESULT get_Metadata(
   IAgKeyValueCollection ** ppRetVal
);
[Java]
public IAgKeyValueCollection getMetadata();

Example

Add Metadata To Object
[C#]Copy Code
stkObject.Metadata.Set("key""value"); 
 

Add ReadOnly Metadata To Object
[C#]Copy Code
stkObject.Metadata.Set("key""value"); 
stkObject.Metadata.SetReadOnly("key"true); 
 

Remove Metadata From Object
[C#]Copy Code
stkObject.Metadata.RemoveKey("key"); 
 

Iterate Metadata Keys
[C#]Copy Code
foreach (string key in stkObject.Metadata.Keys) 

    Console.WriteLine("Key: {0}, Value: {1}", key, stkObject.Metadata[key]); 

 

Check If Metadata Is ReadOnly
[C#]Copy Code
if (stkObject.Metadata.GetReadOnly("test")) 

    Console.WriteLine("The test Metadata element is ReadOnly."); 

 

Check If Metadata Contains Key
[C#]Copy Code
if (stkObject.Metadata.Contains("test")) 

    Console.WriteLine("The collection contains the test element."); 

 

Add Metadata To Object
[Visual Basic .NET]Copy Code
stkObject.Metadata.[Set]("key", "value")

Add ReadOnly Metadata To Object
[Visual Basic .NET]Copy Code
stkObject.Metadata.[Set]("key", "value")
stkObject.Metadata.SetReadOnly("key", True)

Remove Metadata From Object
[Visual Basic .NET]Copy Code
stkObject.Metadata.RemoveKey("key")

Iterate Metadata Keys
[Visual Basic .NET]Copy Code
For Each key As String In stkObject.Metadata.Keys
    Console.WriteLine("Key: {0}, Value: {1}", key, stkObject.Metadata(key))
Next

Check If Metadata Is ReadOnly
[Visual Basic .NET]Copy Code
If stkObject.Metadata.GetReadOnly("test") Then
    Console.WriteLine("The test Metadata element is ReadOnly.")
End If

Check If Metadata Contains Key
[Visual Basic .NET]Copy Code
If stkObject.Metadata.Contains("test") Then
    Console.WriteLine("The collection contains the test element.")
End If

See Also

© 2018 Analytical Graphics, Inc. All Rights Reserved.