Incompatibility User.GetVariable(string)

Post here all your questions related with beta Silverlight API

Moderators: Lapo, Bax

azchohfi
Posts: 3
Joined: 03 Nov 2010, 13:34
Contact:

Incompatibility User.GetVariable(string)

Postby azchohfi » 03 Nov 2010, 13:49

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.

Return to “Silverlight API”

Who is online

Users browsing this forum: No registered users and 9 guests