BaseResult object with ToJson Method


/ Published in: C#
Save to your folder(s)



Copy this code and paste it in your HTML
  1. using System;
  2. using System.Web.Script.Serialization;
  3.  
  4. namespace Test
  5. {
  6. [Serializable]
  7. public class BaseResult
  8. {
  9. public bool Success { get; set; }
  10. public string Message { get; set; }
  11.  
  12. public string ToJson()
  13. {
  14. var serializer = new JavaScriptSerializer();
  15. var _this = serializer.Serialize(this);
  16. return _this;
  17. }
  18. }
  19.  
  20.  
  21. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.