本文整理匯總了VB.NET中System.Xml.Serialization.XmlArrayItemAttribute.IsNullable屬性的典型用法代碼示例。如果您正苦於以下問題:VB.NET XmlArrayItemAttribute.IsNullable屬性的具體用法?VB.NET XmlArrayItemAttribute.IsNullable怎麽用?VB.NET XmlArrayItemAttribute.IsNullable使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類System.Xml.Serialization.XmlArrayItemAttribute
的用法示例。
在下文中一共展示了XmlArrayItemAttribute.IsNullable屬性的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1: Group
Option Explicit
Option Strict
Imports System.IO
Imports System.Xml.Serialization
Public Class Group
<XmlArray(IsNullable := True), _
XmlArrayItem(GetType(Manager), IsNullable := False), _
XmlArrayItem(GetType(Employee), IsNullable := False)> _
Public Employees() As Employee
End Class
Public Class Employee
Public Name As String
End Class
Public Class Manager
Inherits Employee
Public Level As Integer
End Class
Public Class Run
Public Shared Sub Main()
Dim test As New Run()
test.SerializeObject("TypeDoc.xml")
End Sub
Public Sub SerializeObject(filename As String)
Dim s As New XmlSerializer(GetType(Group))
' To write the file, a TextWriter is required.
Dim writer As New StreamWriter(filename)
' Creates the object to serialize.
Dim group As New Group()
' Creates a null Manager object.
Dim mgr As Manager = Nothing
' Creates a null Employee object.
Dim y As Employee = Nothing
group.Employees = New Employee() {mgr, y}
' Serializes the object and closes the TextWriter.
s.Serialize(writer, group)
writer.Close()
End Sub
End Class