本文整理汇总了VB.NET中System.Runtime.InteropServices.MarshalAsAttribute类的典型用法代码示例。如果您正苦于以下问题:VB.NET MarshalAsAttribute类的具体用法?VB.NET MarshalAsAttribute怎么用?VB.NET MarshalAsAttribute使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MarshalAsAttribute类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。
示例1: Module1
' 导入命名空间
Imports System.Runtime.InteropServices
Module Module1
Sub Main()
End Sub
'Applied to a parameter.
Public Sub M1(<MarshalAsAttribute(UnmanagedType.LPWStr)> ByVal msg As String)
msg = msg + "Goodbye"
End Sub
'Applied to a field within a class.
Class MsgText
<MarshalAsAttribute(UnmanagedType.LPWStr)> Public msg As String
End Class
'Applied to a return value.
Public Function M2() As <MarshalAsAttribute(UnmanagedType.LPWStr)> String
Return "Hello World"
End Function
End Module
示例2: Set
Dim _money As Decimal
Public Property Money As <MarshalAs(UnmanagedType.Currency)> Decimal
Get
Return Me._money
End Get
Set(<MarshalAs(UnmanagedType.Currency)> value As Decimal)
Me._money = value
End Set
End Property