Export (0) Print
Expand All
0 out of 2 rated this helpful - Rate this topic

Missing Class

Represents a missing Object. This class cannot be inherited.

For a list of all members of this type, see Missing Members.

System.Object
   System.Reflection.Missing

[Visual Basic]
NotInheritable Public Class Missing
[C#]
public sealed class Missing
[C++]
public __gc __sealed class Missing
[JScript]
public class Missing

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Remarks

Missing is used to invoke a method with a default argument.

Only one instance of Missing ever exists.

Example

[Visual Basic] The following example shows a use of Missing to invoke a method with a default argument.

[Visual Basic] 
Imports System
Imports System.Reflection
Imports Microsoft.VisualBasic

Public Class MissingSample
    
    Shared Sub Main()
        'To invoke MyMethod with a default argument, use the following syntax:
        GetType(MissingSample).GetMethod("MyMethod").Invoke(Nothing, New Object() {Missing.Value})
    End Sub     
    
    Shared Function MyMethod(Optional k As Integer = 33) As Integer
        Console.WriteLine("k = " & k.ToString())
        Return 0
    End Function
End Class

[C#, C++, JScript] No example is available for C#, C++, or JScript. To view a Visual Basic example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Namespace: System.Reflection

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework

Assembly: Mscorlib (in Mscorlib.dll)

See Also

Missing Members | System.Reflection Namespace | DBNull | GetMethod

Show:
© 2014 Microsoft. All rights reserved.