Incompatibility User.GetVariable(string)

Post here all your questions related with beta Silverlight API

Moderators: Lapo, Bax

Post Reply
azchohfi
Posts: 3
Joined: 03 Nov 2010, 13:34

Incompatibility User.GetVariable(string)

Post by azchohfi »

I found a big problem for compatibility with Silverlight and C# APIs.
The C# uses a Hashtable, and if you try to get a variable and the key is not present on the Hashtable, it returns null.
On the other hand, the Silverlight API uses a Dictionary, and in that case, if you try to get a variable and the key is not present, it throwns a KeyNotFoundException.

This is making me change all the code I have for my Desktop game, and I'm sure this is going to be a problem for everybody. The API should work the same way on both platforms.

I'm using Silversprite btw.

I would love to see this fixed.
Actualy, here is the fix:

Code: Select all

		public object GetVariable(string varName)
		{
			object obj = null;
			try
			{
				obj = this.variables[varName];
			}
			catch {}
			
			return obj;
		}
Sure this is only for one small piece of code, but helps already.
I would love to see this for every collection. No exceptions, plx.
Tnx in advance.
Post Reply