i wrote this method in order to convert a xml string into the object:
private object Deserializer(Type type)
{
object instance = null;
try
{
XmlSerializer xmlSerializer = new XmlSerializer(type);
using (StringReader stringreader = new StringReader(somestring))
{
instance = (type)xmlSerializer.Deserialize(stringreader);
}
}
catch (Exception ex)
{
throw ex;
}
return instance;
}
but here:
instance = (type)xmlSerializer.Deserialize(stringreader);
this error shows up: The type or namespace name 'type' could not be found (are you missing a using directive or an assembly reference?) how can i fix it?