ToSerializableId()
Gets a string-based identifier that uniquely identifies the current declaration within a compilation.
Declaration
SerializableDeclarationId ToSerializableId()Returns
| Type | Description |
|---|---|
| SerializableDeclarationId | A serializable declaration identifier. |
Remarks
Unlike ToRef(), which returns a strongly-typed reference object, this method returns a lightweight string-based identifier that can be persisted to disk or transmitted across processes. The identifier is guaranteed to be resolvable in a different process, even with a different version of Metalama.
For a declaration of a file-local type, that guarantee holds on the machine that produced the identifier,
and on another machine only when both projects are built with the pathmap option, as a deterministic
build does. See SerializableDeclarationId.
Use Resolve(ICompilation) or GetDeclarationFromId(SerializableDeclarationId) to resolve the identifier back to a declaration.