I m trying to serialize a RealmObject in my uwp project and I would like to know if there is any way to to ignore ObjectSchema and Ream properties when serializing a realmObject ? I tried to create a constuctor to avoid copying these two properties but It doesn't worked for me.
This is my object :
public class Sector : RealmObject, NodeBase
{
[PrimaryKey]
public int id { get; set; }
public string key { get; set; }
[Ignored]
public Dictionary<string, string> title { get; set; }
[JsonIgnore]
public Dictionary Title { get; set; }
public int position { get; set; }
public bool template_is_carousel { get; set; }
public bool isVisible { get; set; }
public IList<string> filter { get; }
[Ignored]
public DisplayType display_type { get; set; }
[JsonIgnore]
public string DisplayType { get; set; }
public int parent_id { get; set; }
public string parent_type { get; set; }
public string image_url { get; set; }
public string banner_color { get; set; }
public int template_rows { get; set; } = 3;
public int template_columns { get; set; } = 2;
public Sector(Sector sector)
{
this.id = sector.id;
this.key = sector.key;
this.Title = sector.Title;
this.title = sector.title;
this.position = sector.position;
this.template_is_carousel = sector.template_is_carousel;
this.isVisible = sector.isVisible;
this.filter = sector.filter;
this.display_type = sector.display_type;
this.DisplayType = sector.DisplayType;
this.parent_id = sector.parent_id;
this.parent_type = sector.parent_type;
this.image_url = sector.image_url;
this.banner_color = sector.banner_color;
this.template_rows = sector.template_rows;
this.template_columns = sector.template_columns;
}
public Sector()
{
}
}
And this is how I m serializing my object :
private string serializeParameter(object parameter)
{
return JsonConvert.SerializeObject(parameter);
}