IMetaDataEmit::DefineField Method

Creates a definition for a field with the specified metadata signature, and gets a token to that field definition.

Syntax

HRESULT DefineField (
    [in]  mdTypeDef   td,
    [in]  LPCWSTR     szName,
    [in]  DWORD       dwFieldFlags,
    [in]  PCCOR_SIGNATURE pvSigBlob,
    [in]  ULONG       cbSigBlob,
    [in]  DWORD       dwCPlusTypeFlag,
    [in]  void const  *pValue,
    [in]  ULONG       cchValue,
    [out] mdFieldDef  *pmd
);  

Parameters

td
[in] The mdTypeDef token for the enclosing class or interface.

szName
[in] The field name in Unicode.

dwFieldFlags
[in] The field attributes. This is a bitmask of CorFieldAttr values.

pvSigBlob
[in] The field signature as a BLOB.

cbSigBlob
[in] The count of bytes in pvSigBlob.

dwCPlusTypeFlag
[in] The ELEMENT_TYPE_* for the constant value. This is a CorElementType value. If not defining a constant value for the field, use ELEMENT_TYPE_END.

pValue
[in] The constant value for the field.

cchValue
[in] The size in (Unicode) characters of pValue.

pmd
[out] The mdFieldDef token assigned.

Requirements

Platforms: See System Requirements.

Header: Cor.h

Library: Used as a resource in MSCorEE.dll

.NET Framework Versions: Available since 1.0

See also