I'm writing a custom JavaScript converter to deserialize some JSON. Here's a few lines I'm writing:
public override object Deserialize(IDictionary<string, object> dictionary, Type type,
JavaScriptSerializer serializer)
{
int NoteID;
NotesModel TheObject = new NotesModel();
if (dictionary.ContainsKey("NoteID"))
{
if (int.TryParse(serializer.ConvertToType<string>(dictionary["NoteID"]),
out NoteID))
{
TheObject.NoteID = serializer.ConvertToType<int>(dictionary["NoteID"]);
}
}
How can this be improved?