Missing Class
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Represents a missing Object. This class cannot be inherited.
Assembly: mscorlib (in mscorlib.dll)
The Missing type exposes the following members.
| Name | Description | |
|---|---|---|
![]() | Equals(Object) | Determines whether the specified Object is equal to the current Object. (Inherited from Object.) |
![]() | Finalize | Allows an object to try to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.) |
![]() | GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) |
![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() | MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) |
![]() | ToString | Returns a string that represents the current object. (Inherited from Object.) |
The following example shows how to use Missing to invoke a method with a default argument with late binding.
To run this example, first see Building examples that have static TextBlock controls for Windows Phone 8. Once you have created an application project, you must include the following Visual Basic code. For a Visual Basic application, add the code to your project as a new class. For a C# application, add a Visual Basic class library project, and create a reference to this project from your C# project.
Public Class MissingSample
Public Shared Function MyMethod(Optional k As Integer = 33) As String
Return "k = " & k.ToString()
End Function
End Class
Note: |
|---|
The C# code in this example assumes that the Visual Basic class library project is named MyLibrary; if you name it something else you must change the namespace that is shown in the argument of the GetMethod method. |
Visual Basic code is used for the MissingSample class because C# does not support optional parameters in managed code. Optional parameters are not part of the Common Language Specification (CLS). Therefore, code that uses optional parameters is not CLS-compliant. For more information, see the Common Language Specification and Writing CLS-Compliant Code in the .NET Framework documentation.




Note: