C# Type Missing
In this chapter you will learn:
Description
Type Missing
represents a missing value in the Type information.
This field is read-only.
Syntax
Type.Missing
has the following syntax.
public static readonly Object Missing
Example
The following code example shows the use of the Missing field to invoke a method with its default arguments.
using System;/*from ww w .j a v a2s . c om*/
using System.Reflection;
using System.CodeDom.Compiler;
class Example
{
public static void Main()
{
Type t = typeof(System.String);
BindingFlags bf = BindingFlags.Public | BindingFlags.Instance |
BindingFlags.InvokeMethod | BindingFlags.OptionalParamBinding;
t.InvokeMember("MyMethod", bf, null, o, new object[] {10, 55.3, 12});
t.InvokeMember("MyMethod", bf, null, o, new object[] {10, 1.3, Type.Missing});
t.InvokeMember("MyMethod", bf, null, o, new object[] {10, Type.Missing, Type.Missing});
}
}
Next chapter...
What you will learn in the next chapter:
...
C# Type EmptyTypes
C# Type FilterAttribute
C# Type FilterName
C# Type FilterNameIgnoreCase
C# Type AssemblyQualifiedName
C# Type Attributes
C# Type BaseType
C# Type ContainsGenericParameters
C# Type CustomAttributes
C# Type DeclaringMethod
C# Type DeclaringType
C# Type DefaultBinder
C# Type FullName
C# Type GenericParameterAttributes
C# Type GenericParameterPosition
C# Type GenericTypeArguments
C# Type GUID
C# Type HasElementType
C# Type IsAbstract
C# Type IsAnsiClass
C# Type IsArray
C# Type IsAutoClass
C# Type IsAutoLayout
C# Type IsByRef
C# Type IsClass
C# Type IsCOMObject
C# Type IsConstructedGenericType
C# Type IsContextful
C# Type IsEnum
C# Type IsExplicitLayout
C# Type IsGenericParameter
C# Type IsGenericType
C# Type IsGenericTypeDefinition
C# Type IsImport
C# Type IsInterface
C# Type IsLayoutSequential
...
C# Type EmptyTypes
C# Type FilterAttribute
C# Type FilterName
C# Type FilterNameIgnoreCase
C# Type Missing
C# Type AssemblyC# Type AssemblyQualifiedName
C# Type Attributes
C# Type BaseType
C# Type ContainsGenericParameters
C# Type CustomAttributes
C# Type DeclaringMethod
C# Type DeclaringType
C# Type DefaultBinder
C# Type FullName
C# Type GenericParameterAttributes
C# Type GenericParameterPosition
C# Type GenericTypeArguments
C# Type GUID
C# Type HasElementType
C# Type IsAbstract
C# Type IsAnsiClass
C# Type IsArray
C# Type IsAutoClass
C# Type IsAutoLayout
C# Type IsByRef
C# Type IsClass
C# Type IsCOMObject
C# Type IsConstructedGenericType
C# Type IsContextful
C# Type IsEnum
C# Type IsExplicitLayout
C# Type IsGenericParameter
C# Type IsGenericType
C# Type IsGenericTypeDefinition
C# Type IsImport
C# Type IsInterface
C# Type IsLayoutSequential
...