Koolitus
Moodul
Send and pass data as output from the pipeline - Training
This module explains how to send pipeline data to files and in various output formats.
Seda brauserit enam ei toetata.
Uusimate funktsioonide, turbevärskenduste ja tehnilise toe kasutamiseks võtke kasutusele Microsoft Edge.
This example writes the object from a class to an XML file using the XmlSerializer class.
Public Module XMLWrite
Sub Main()
WriteXML()
End Sub
Public Class Book
Public Title As String
End Class
Public Sub WriteXML()
Dim overview As New Book
overview.Title = "Serialization Overview"
Dim writer As New System.Xml.Serialization.XmlSerializer(GetType(Book))
Dim file As New System.IO.StreamWriter(
"c:\temp\SerializationOverview.xml")
writer.Serialize(file, overview)
file.Close()
End Sub
End Module
The class must have a public constructor without parameters.
The following conditions may cause an exception:
The class being serialized does not have a public, parameterless constructor.
The file exists and is read-only (IOException).
The path is too long (PathTooLongException).
The disk is full (IOException).
This example creates a new file, if the file does not already exist. If an application needs to create a file, that application needs Create
access for the folder. If the file already exists, the application needs only Write
access, a lesser privilege. Where possible, it is more secure to create the file during deployment, and only grant Read
access to a single file, rather than Create
access for a folder.
Toote „.NET“ tagasiside
.NET on avatud lähtekoodiga projekt. Tagasiside andmiseks valige link:
Koolitus
Moodul
Send and pass data as output from the pipeline - Training
This module explains how to send pipeline data to files and in various output formats.