Encapsulates a string that uniquely identifies a declaration within a compilation and that is safe to persist in a file or serialize across processes.
Implements
Namespace: Metalama.Framework.Code
Assembly: Metalama.Framework.dll
Syntax
[CompileTime]
public readonly struct SerializableDeclarationId : IEquatable<SerializableDeclarationId>Remarks
This struct provides a lightweight, string-based identifier for declarations that can be serialized to disk or transmitted across processes. Unlike IRef<T>, which maintains a reference to the declaration, this struct stores only the string identifier.
To obtain a SerializableDeclarationId, call ToSerializableId() or ToSerializableId(). To resolve the identifier back to a declaration, call Resolve(ICompilation) or GetDeclarationFromId(SerializableDeclarationId).
Limitation: The identifier may not be unique if the compilation contains several assemblies providing types with the same fully qualified name.
Constructors
| Name | Description |
|---|---|
| SerializableDeclarationId(string) | Initializes a new instance of the SerializableDeclarationId struct with the specified identifier string. |
Properties
| Name | Description |
|---|---|
| Id | Gets the string identifier for this declaration. |
Methods
| Name | Description |
|---|---|
| Equals(SerializableDeclarationId) | |
| Equals(object?) | |
| GetHashCode() | |
| Resolve(ICompilation) | Resolves this identifier to the corresponding IDeclaration in the specified compilation. |
| ToString() |
Operators
| Name | Description |
|---|---|
| operator ==(SerializableDeclarationId, SerializableDeclarationId) | Determines whether two SerializableDeclarationId instances are equal. |
| operator !=(SerializableDeclarationId, SerializableDeclarationId) | Determines whether two SerializableDeclarationId instances are not equal. |