Having a class defined:
[DataContract]
public class Command
{
[DataMember(Name = "cmdName")]
public string CommandName { get; set; }
[DataMember(Name = "cmdTransactionId")]
public string CommandTransactionId { get; set; }
}
I would like to create an instance of that class from a dictionary:
Dictionary<string, object> propertyBag = new Dictionary<string, object>();
propertyBag["cmdName"] = "cmd1";
propertyBag["cmdTransactionId"] = "1";
Command command = deserializer.Create<Command>(propertyBag);
DataContractSerializer
is not working for me nor is the JavaScriptSerializer.ConvertToType
as each of them is missing a piece that stop s me from creating objects in one go.