I Serialized Contact and Saved it in text file in The Isolated Store
I want to Deserialize it back as Contact
I tried this Code but I get error :
Error 1 The type 'Microsoft.Phone.UserData.Contact' has no constructors
using (var reader = new StreamReader(stream))
{
var serializer = new XmlSerializer(typeof(Contact));
return reader.EndOfStream
? new Contact()// error
: (Contact)serializer.Deserialize(reader);
}
is there another solut开发者_运维百科ion to get it back ?
That looks like it is not intended for this purpose; all the properties are get
, and there is no (public) constructor. XmlSerializer
will not work on that.
IMO your best option is to create something of your own that looks like that class, but is serialization-friendly.
精彩评论