IMetaDataEmit::DefineField Method

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

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.

  • dwCPlusTypeFlage
    [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 .NET Framework System Requirements.

Header: Cor.h

Library: Used as a resource in MSCorEE.dll

.NET Framework Versions: 4, 3.5 SP1, 3.5, 3.0 SP1, 3.0, 2.0 SP1, 2.0, 1.1, 1.0

See Also

Reference

IMetaDataEmit Interface

IMetaDataEmit2 Interface