本文整理匯總了VB.NET中System.Type.Missing字段的典型用法代碼示例。如果您正苦於以下問題:VB.NET Type.Missing字段的具體用法?VB.NET Type.Missing怎麽用?VB.NET Type.Missing使用的例子?那麽, 這裏精選的字段代碼示例或許可以為您提供幫助。您也可以進一步了解該字段所在類System.Type
的用法示例。
在下文中一共展示了Type.Missing字段的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1: OptionalArg
' 導入命名空間
Imports System.Reflection
Public Class OptionalArg
Public Sub MyMethod(ByVal a As Integer, _
Optional ByVal b As Double = 1.2, _
Optional ByVal c As Integer = 1)
Console.WriteLine("a = " & a & " b = " & b & " c = " & c)
End Sub
End Class
Class Example
Public Shared Sub Main()
Dim o As New OptionalArg()
Dim t As Type
t = GetType(OptionalArg)
Dim bf As BindingFlags = _
BindingFlags.Public Or BindingFlags.Instance Or _
BindingFlags.InvokeMethod Or BindingFlags.OptionalParamBinding
t.InvokeMember("MyMethod", bf, Nothing, o, New Object() {10, 55.3, 12})
t.InvokeMember("MyMethod", bf, Nothing, o, New Object() {10, 1.3, Type.Missing})
t.InvokeMember("MyMethod", bf, Nothing, o, New Object() {10, Type.Missing, Type.Missing})
End Sub
End Class