Created
September 16, 2014 10:50
-
-
Save margusmartsepp/db0d1fba80c6fc4944f9 to your computer and use it in GitHub Desktop.
String DeserializeJson
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static class Extensions | |
| { | |
| public static bool DeserializeJson<T>(this String str, out T item) | |
| { | |
| item = default(T); | |
| try | |
| { | |
| item = new JavaScriptSerializer().Deserialize<T>(str); | |
| return true; | |
| } | |
| catch (Exception ex) | |
| { | |
| return false; | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment