Skip to content

Instantly share code, notes, and snippets.

@cerkit
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cerkit/9748270 to your computer and use it in GitHub Desktop.
Save cerkit/9748270 to your computer and use it in GitHub Desktop.
The base Entity class for my portable class library.
using Newtonsoft.Json;
using System.IO;
namespace RecordKeeper.Portable.Models
{
public abstract class EntityBase
{
public EntityBase() { }
#region Properties
public string Id { get; set; }
public string Description { get; set; }
#endregion
#region Utility Methods
public string ToJson()
{
StringWriter w = new StringWriter();
JsonSerializer s = new JsonSerializer();
s.Serialize(new JsonTextWriter(w), this);
return w.ToString();
}
#endregion
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment