I have the following class:
namespace GPR.ODS.App.MSO.WebApp.Data
{
public partial class MutatieResponse
{
private MutatieStatus mutatieStatusField;
private ApplicatieFout applicatieFoutField;
///// <remarks/>
public MutatieStatus MutatieStatus
{
get
{
return this.mutatieStatusField;
}
set
{
this.mutatieStatusField = value;
}
}
///// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Namespace = "]
public ApplicatieFout ApplicatieFout
{
get
{
return this.applicatieFoutField;
}
set
{
this.applicatieFoutField = value;
}
}
}
}
I am trying to code a static procedure which takes an object as a parameter and map the properties to the object Mutatieresponse.
I have got the following code:
public static class ConvertToMutatieResponse
{
public static MutatieResponse Convert(object value)
{
MutatieResponse mutatieResponse = new MutatieResponse();
mutatieResponse.MutatieStatus = value.GetType().GetProperty("MutatieStatus", typeof(mutatieResponse.MutatieStatus)).GetValue(value, null);
return mutatieResponse;
}
}
It keeps telling me "Cannot implicitly convert type 'object' to 'GPR.ODS.App.MSO.WebApp.Data.MutatieStatus'. An explicit conversion exists (are you missing a cast?)"
How can I return the value with the correct type?
namespace GPR.ODS.App.MSO.WebApp.Data
{
public partial class MutatieResponse
{
private MutatieStatus mutatieStatusField;
private ApplicatieFout applicatieFoutField;
///// <remarks/>
public MutatieStatus MutatieStatus
{
get
{
return this.mutatieStatusField;
}
set
{
this.mutatieStatusField = value;
}
}
///// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Namespace = "]
public ApplicatieFout ApplicatieFout
{
get
{
return this.applicatieFoutField;
}
set
{
this.applicatieFoutField = value;
}
}
}
}
I am trying to code a static procedure which takes an object as a parameter and map the properties to the object Mutatieresponse.
I have got the following code:
public static class ConvertToMutatieResponse
{
public static MutatieResponse Convert(object value)
{
MutatieResponse mutatieResponse = new MutatieResponse();
mutatieResponse.MutatieStatus = value.GetType().GetProperty("MutatieStatus", typeof(mutatieResponse.MutatieStatus)).GetValue(value, null);
return mutatieResponse;
}
}
It keeps telling me "Cannot implicitly convert type 'object' to 'GPR.ODS.App.MSO.WebApp.Data.MutatieStatus'. An explicit conversion exists (are you missing a cast?)"
How can I return the value with the correct type?