Gets the estimated binary size of the assembly and its metadata in the current scope.
HRESULT GetSaveSize ( [in] CorSaveSize fSave, [out] DWORD *pdwSaveSize );
[in] A value of the CorSaveSize enumeration that specifies whether to get an accurate or approximate size. Only three values are valid: cssAccurate, cssQuick, and cssDiscardTransientCAs:
cssAccurate returns the exact save size but takes longer to calculate.
cssQuick returns a size, padded for safety, but takes less time to calculate.
GetSaveSizethat it can throw away discardable custom attributes.
[out] A pointer to the size that is required to save the file.
GetSaveSize calculates the space required, in bytes, to save the assembly and all its metadata in the current scope. (A call to the IMetaDataEmit::SaveToStream method would emit this number of bytes.)
If the caller implements the IMapToken interface (through IMetaDataEmit::SetHandler or IMetaDataEmit::Merge),
GetSaveSize will perform two passes over the metadata to optimize and compress it. Otherwise, no optimizations are performed.
If optimization is performed, the first pass simply sorts the metadata structures to tune the performance of import-time searches. This step typically results in moving records around, with the side effect that tokens retained by the tool for future reference are invalidated. The metadata does not inform the caller of these token changes until after the second pass, however. In the second pass, various optimizations are performed that are intended to reduce the overall size of the metadata, such as optimizing away (early binding)
mdMemberRef tokens when the reference is to a type or member that is declared in the current metadata scope. In this pass, another round of token mapping occurs. After this pass, the metadata engine notifies the caller, through its
IMapToken interface, of any changed token values.
Platforms: See System Requirements.
Library: Used as a resource in MSCorEE.dll
.NET Framework Versions: Available since 1.1