I’m creating a custom object to save, and use, on PriceList.CustomData. This custom class needs to inherit from IReadOnly. How to use MakeReadOnly and MakeWritableClone methods?
This is what I got right now:
public class PriceListCustomDataVariantList : IReadOnly
{
public List<PriceListCustomDataVariantItem> VariantList { get; set; }
public bool IsReadOnly => false;
public void MakeReadOnly()
{ }
public object MakeWritableClone()
{
return null;
}
}
I need to use MakeWriteableClone on this custom ireadonly class. How to implement that function correctly? Now I return null but that obviously don’t work.
Yes, I would like that. I don’t know how the standard implementation of MakeWriteableClone looks like because IReadOnly is in the Litium-assembly.
If we take VariantService.Get() for example, it has the MakeWrieableClone method that returns a Variant object. I want to do the exact same thing in my custom class.
public class A : ObjectBase<A>
{
private IList<string> _list = new List<string>();
public IList<string> List { get => _list; set => _list = this.ThrowIfReadOnly(value); }
}
public class B
{
public B()
{
var a = new A();
a.MakeWritableClone();
}
}