Silverlight Serialize/Desirialize

2 posts, 0 answers
  1. CapriconF
    CapriconF avatar
    1 posts
    Member since:
    May 2015

    Posted 27 May 2015 Link to this post

    Trying desalinize  ArtOfTest.WebAii.Silverlight.UI.Color object. First I I called serialize method and got string - "{\"A\":255,\"B\":128,\"G\":128,\"R\":128}"

    Then I try:
     ArtOfTest.WebAii.Silverlight.UI.Color colorGr = new Color();
                colorGr.Deserialize("{\"A\":255,\"B\":128,\"G\":128,\"R\":128}");

    When I check properties of colorGr - nothing been set???

  2. Boyan Boev
    Admin
    Boyan Boev avatar
    1039 posts

    Posted 01 Jun 2015 Link to this post

    Hi Igor,

    Unfortunately Deserialize method doesn't set the property directly. It returns an object. You should modify your code as follows:

    Color color = new Color();
    Color c = color.Deserialize("{\"A\":255,\"B\":128,\"G\":128,\"R\":128}") as Color;
    Log.WriteLine(c.Serialize().ToString());

    Hope this helps.

    Regards,
    Boyan Boev
    Telerik
     
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
     
Back to Top