vendredi 15 septembre 2017

how unbox object into actual object by name of class

I want do unboxing of object to its actual type by using name of actual object.

type Employee = {
    Id:int
    Name:string
}
let defEmployee = {
    Id=1
    Name="Mahi"
}

//actual object
let actualObject = defEmployee
let empAsObject = actualObject :> obj // type with casted in base class
let actualObject = unbox(empAsObject) //here I am trying to unboxing but not 
   able to do it.

I can do it when I have actual type of object run-time but I have only name of type/object





Aucun commentaire:

Enregistrer un commentaire