本文整理汇总了VB.NET中System.Type.IsLayoutSequential属性的典型用法代码示例。如果您正苦于以下问题:VB.NET Type.IsLayoutSequential属性的具体用法?VB.NET Type.IsLayoutSequential怎么用?VB.NET Type.IsLayoutSequential使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类System.Type
的用法示例。
在下文中一共展示了Type.IsLayoutSequential属性的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。
示例1: MyTypeSequential1
' 导入命名空间
Imports System.Reflection
Imports System.ComponentModel
Imports System.Runtime.InteropServices
Class MyTypeSequential1
End Class
<StructLayoutAttribute(LayoutKind.Sequential)> Class MyTypeSequential2
Public Shared Sub Main()
Try
' Create an instance of MyTypeSequential1.
Dim myObj1 As New MyTypeSequential1()
Dim myTypeObj1 As Type = myObj1.GetType()
' Check for and display the SequentialLayout attribute.
Console.WriteLine(ControlChars.Cr + "The object myObj1 has IsLayoutSequential: {0}.", myObj1.GetType().IsLayoutSequential.ToString())
' Create an instance of MyTypeSequential2.
Dim myObj2 As New MyTypeSequential2()
Dim myTypeObj2 As Type = myObj2.GetType()
' Check for and display the SequentialLayout attribute.
Console.WriteLine(ControlChars.Cr + "The object myObj2 has IsLayoutSequential: {0}.", myObj2.GetType().IsLayoutSequential.ToString())
Catch e As Exception
Console.WriteLine(ControlChars.Cr + "An exception occurred: {0}", e.Message.ToString())
End Try
End Sub
End Class