Missing Class


Represents a missing Object. This class cannot be inherited.

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


public sealed class Missing : ISerializable


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


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


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


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


Represents the sole instance of the Missing class.

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.

using System;
using System.Reflection;


public class MissingClass
   public static void MethodWithDefault(int value = 33)
      Console.WriteLine("value = {0}", value);

public class Example
   public static void Main()
      // Invoke without reflection

      // Invoke by using reflection.
      Type t = typeof(MissingClass);
      MethodInfo mi = t.GetMethod("MethodWithDefault");
      mi.Invoke(null, new object[] { Missing.Value });
// 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
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