static object DeepCopy(object src)
{
BinaryFormatter Formatter = new BinaryFormatter(null, new StreamingContext(StreamingContextStates.Clone));
using (MemoryStream stream = new MemoryStream())
{
Formatter.Serialize(stream, src);
stream.Position = 0;
return Formatter.Deserialize(stream);
}
}
/// <summary>
/// 处理结果。
/// </summary>
public class ProcessResultDTO
{
public bool IsSucceed { get; set; }
public string Message { get; set; }
public object Data { get; set; }
}
var dto = JsonConvert.DeserializeObject<ProcessResultDTO>(str);
Album album = (dto.Data as JToken).ToObject<Album>();