Missing Class
Collapse the table of content
Expand the table of content

Missing Class

Represents a missing Object. This class cannot be inherited.

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


[Visual Basic]
NotInheritable Public Class Missing
public sealed class Missing
public __gc __sealed class Missing
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.


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

Only one instance of Missing ever exists.


[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.


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

© 2015 Microsoft