From iLab Cookbook

Toolkits: HowToRetrieveValuesFromTheSharedDictionary

<< Back to the .Networking page

Integer: retrieves an integer from a shared dictionary called SD at the path /value:

int x = (int) this.SD.GetEntry("/value").Value;

String: retrieves a string from a shared dictionary called SD at the path /value:

string y = this.SD.GetEntry("/value").Value.ToString();

Vector: retrieves a vector from a shared dictionary called SD at the path /value:

SharedDictionary.Vector v = this.SD["/value"] as SharedDictionary.Vector;

Vector Elements: retrieves an integer from the last element of a vector. The vector is in the shared dictionary called SD at the path /value.

SharedDictionary.Vector v = this.SD["/value"] as SharedDictionary.Vector;
int z = (int) v[0];

Subscription Notifications: retrieves a string from the shared dictionary during a subscription notification.

private void sub_Notified(object sender, SubscriptionEventArgs e)
{
  string location = (string) e.Entry.Value;
}


Retrieved from http://grouplab.cpsc.ucalgary.ca/cookbook/index.php/Toolkits/HowToRetrieveValuesFromTheSharedDictionary
Page last modified on December 31, 2005, at 12:07 AM