Cast JObject(dynamic get) to base class


#1

hi i am having problem casting the result of dynamic document
i need the Value/Content to be stored in a base class

public class BaseObj
{
public string baseStr = “BaseObj”;
};
public class DerivedObj : BaseObj
{
public string deriveStr = “DerivedObj”;
};
class Program
{

    private static void Main(string[] args)
    {

        BaseObj myObj = new DerivedObj();
        var cluster = new Cluster();
        IBucket bucket = cluster.OpenBucket();
        bucket.Upsert("document_id", myObj);
        var JObject = bucket.Get<dynamic>("document_id");

       // now i need to cast JObject to BaseObj without losing the derived value something like
   
        BaseObj CBObj = JObject.Value;
}

any idea how to do this
tnx doron