Skip to content

Instantly share code, notes, and snippets.

@prabirshrestha
Created November 21, 2012 23:04
Show Gist options
  • Save prabirshrestha/4128421 to your computer and use it in GitHub Desktop.
Save prabirshrestha/4128421 to your computer and use it in GitHub Desktop.
public object DoSomething(string jsonString) {
var json = DeserializeJson(jsonString);
var dict = json as IDictionary<string, object>;
if(dict == nul) {
// use another serializer to normalize the json
// and set dict.
} else {
// DeserializeJson worked so do nothing.
}
var algorithm = (string)envelope["algorithm"];
// some validation stuff here
return json;
}
dynamic result = DoSomething(jsonString);
string algorithm = result.algorithm;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment