MetadataBuilder.AddTypeDefinition Method

Definition

Adds a type definition.

public:
 System::Reflection::Metadata::TypeDefinitionHandle AddTypeDefinition(System::Reflection::TypeAttributes attributes, System::Reflection::Metadata::StringHandle namespace, System::Reflection::Metadata::StringHandle name, System::Reflection::Metadata::EntityHandle baseType, System::Reflection::Metadata::FieldDefinitionHandle fieldList, System::Reflection::Metadata::MethodDefinitionHandle methodList);
public System.Reflection.Metadata.TypeDefinitionHandle AddTypeDefinition (System.Reflection.TypeAttributes attributes, System.Reflection.Metadata.StringHandle namespace, System.Reflection.Metadata.StringHandle name, System.Reflection.Metadata.EntityHandle baseType, System.Reflection.Metadata.FieldDefinitionHandle fieldList, System.Reflection.Metadata.MethodDefinitionHandle methodList);
member this.AddTypeDefinition : System.Reflection.TypeAttributes * System.Reflection.Metadata.StringHandle * System.Reflection.Metadata.StringHandle * System.Reflection.Metadata.EntityHandle * System.Reflection.Metadata.FieldDefinitionHandle * System.Reflection.Metadata.MethodDefinitionHandle -> System.Reflection.Metadata.TypeDefinitionHandle
Public Function AddTypeDefinition (attributes As TypeAttributes, namespace As StringHandle, name As StringHandle, baseType As EntityHandle, fieldList As FieldDefinitionHandle, methodList As MethodDefinitionHandle) As TypeDefinitionHandle

Parameters

attributes
TypeAttributes

The type attributes.

namespace
StringHandle

The type namespace.

name
StringHandle

The type name.

baseType
EntityHandle

The base type entity handle, which can be one of the following: TypeDefinitionHandle, TypeReferenceHandle, TypeSpecificationHandle, or null.

fieldList
FieldDefinitionHandle

If the type declares fields, set this to the handle of the first one. Otherwise, set this to the handle of the first field declared by the next type definition. If no type defines any fields in the module, System.Reflection.Metadata.Ecma335.MetadataTokens.FieldDefinitionHandle(1).

methodList
MethodDefinitionHandle

If the type declares methods, the handle of the first one. Otherwise, the handle of the first method declared by the next type definition. If no type defines any methods in the module, System.Reflection.Metadata.Ecma335.MetadataTokens.MethodDefinitionHandle(1).

Returns

A handle to the added type definition.

Exceptions

baseType doesn't have the expected handle kind.

Applies to