OK I did it. This is how :-
private void DeserializeObject(string inxml)
{
Debug.WriteLine("Reading with XmlReader");
var xml = inxml;
var serializer = new XmlSerializer(typeof(User));
using (var reader = new StringReader(xml))
{
var user = (User)serializer.Deserialize(reader);
Debug.WriteLine(
user.Number + "\t" +
user.Id + "\t" +
user.TextKey + "\t" +
user.Agent );
}
}
Instead of passing the file url, I passed the complete string. And the rest is as shown above.
Hope this will be helpful to someone who is learning.