SmartFoxServer Silverlight API
SetUserVariables Method (varObj, roomId)
NamespacesSmartFoxClientAPISmartFoxClientSetUserVariables(Dictionary<(Of <(String, Object>)>), Int32)
Set on or more User Variables.
User Variables are a useful tool to store user data that has to be shared with other users. When a user sets/updates/deletes one or more User Variables, all the other users in the same room are notified.
Allowed data types for User Variables are Numbers, Strings and Booleans; Arrays and Objects are not supported in order save bandwidth.
If a User Variable is set to null, it is deleted from the server. Also, User Variables are destroyed when their owner logs out or gets disconnected.
Declaration Syntax
C#Visual BasicVisual C++
public void SetUserVariables(
	Dictionary<string, Object> varObj,
	int roomId
)
Public Sub SetUserVariables ( _
	varObj As Dictionary(Of String, Object), _
	roomId As Integer _
)
public:
void SetUserVariables(
	Dictionary<String^, Object^>^ varObj, 
	int roomId
)
Parameters
varObj (Dictionary<(Of <(String, Object>)>))
an object in which each property is a variable to set/update.
roomId (Int32)
the room id where the request was originated, in case of molti-room join (optional, default value: activeRoomId).
Remarks

Sends:
SFSEvent..::.OnUserVariablesUpdateDelegate

Version:
SmartFoxServer Basic / Pro

Examples
The following example shows how to save the user data (avatar name and position) in an avatar chat application.
CopyC#
Dictionary<string, object> uVars = new Dictionary<string, object>();
uVars.Add("myAvatar", "Homer");
uVars.Add("posx", 100);
uVars.Add("posy", 200);

smartFox.SetUserVariables(uVars);
See Also

Assembly: SmartFoxClientAPI_Silverlight (Module: SmartFoxClientAPI_Silverlight) Version: 1.0.0.0 (1.0.0.0)