Missing Class

 

Represents a missing Object. This class cannot be inherited.

Namespace:   System.Reflection
Assembly:  mscorlib (in mscorlib.dll)

System.Object
  System.Reflection.Missing

<SerializableAttribute>
<ComVisibleAttribute(True)>
Public NotInheritable Class Missing
	Implements ISerializable

NameDescription
System_CAPS_pubmethodEquals(Object)

Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_pubmethodGetHashCode()

Serves as the default hash function. (Inherited from Object.)

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_pubmethodToString()

Returns a string that represents the current object.(Inherited from Object.)

NameDescription
System_CAPS_pubfieldSystem_CAPS_staticValue

Represents the sole instance of the Missing class.

NameDescription
System_CAPS_pubinterfaceSystem_CAPS_privmethodISerializable.GetObjectData(SerializationInfo, StreamingContext)

Sets a SerializationInfo object with the logical context information needed to recreate the sole instance of the Missing object.

The Missing class is used to invoke a method with a default argument, typically when using reflection.

Only one instance of Missing, which is returned by the Value field, ever exists.

The following example shows how to use the Missing object to invoke a method with a default argument by using reflection.

Imports System.Reflection

<Assembly:CLSCompliant(True)>

Public Class MissingClass
   Public Shared Sub MethodWithDefault(Optional value As Integer = 33)
      Console.WriteLine("value = {0}", value)
   End Sub 
End Class   

Public Module Example
   Public Sub Main()
      ' Invoke without reflection.
      MissingClass.MethodWithDefault()

      ' Invoke by using reflection.
      Dim t As Type = GetType(MissingClass)
      Dim mi As MethodInfo = t.GetMethod("MethodWithDefault")
      mi.Invoke(Nothing, { Missing.Value })
   End Sub
End Module
' The example displays the following output:
'       value = 33 
'       value = 33 

Universal Windows Platform
Available since 8
.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1

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

Return to top
Show: