ADO.NET Quiz Object Sequence

xiaoxiao2021-03-06  70

Assume that there is an entity class. Using system.xml; using system.xml.serialization;

Namespace TestPerson {Public Class Person {Public String Fullname

Public String Password; Public Male Sex;}

Public Enum Male {m, f}} first decided to use XML serialization to put the status DUMP of the object to an XML file. The code is as follows: Person P = New Person (); p.FullName = "MontaQuehou"; p.password = "test"; p.sex = Male.m;

XMLSERIALIZER DEMOSERIALIZER = New XMLSerializer (TypeOf (Person));

FILESTREAM FS = New FileStream ("C: //test.xml", filemode.create, fileaccess.readwrite; Demoserializer.Serialize (fs, p); fs.close (); Note Reference System.Runtime.Serialization.Formatters. The DLL problem is: 1. Does the Person class do not add a serilizable property? Can you serialize successful? 2. Can PASSWORD be dUMP to file?

转载请注明原文地址:https://www.9cbs.com/read-91379.html

New Post(0)