Description
The GetMetaOrDefault
method retrieves a metadata value associated with the specified key from the project configuration. If the key does not exist, it returns a default value provided by the caller. This method is useful for accessing custom metadata stored in the project configuration without having to check for the existence of the key manually.
Usage
To use the GetMetaOrDefault
method, call it on an instance of ProjectConfig
, passing the key name as a string and the default value of type T
that you want to return if the key is not found.
Example
// Example usage of GetMetaOrDefault
var projectConfig = new ProjectConfig();
// Assume "author" is a key in the metadata
string author = projectConfig.GetMetaOrDefault("author", "Unknown Author");
// If "author" key does not exist, "author" will be "Unknown Author"