static bool TryGetCached( string identString, Sandbox.Package& package, bool allowPartial )

robot_2Generated
code_blocksInput

Description

The TryGetCached method attempts to retrieve a cached Package object based on a given identifier string. It returns a boolean indicating whether the operation was successful. If successful, the method outputs the retrieved Package object through an out parameter.

Usage

To use the TryGetCached method, provide the identifier string of the package you want to retrieve, a boolean indicating whether partial matches are allowed, and an uninitialized Package variable to store the result if found. The method will return true if the package is successfully retrieved from the cache, otherwise false.

Example

// Example usage of TryGetCached
string packageIdentifier = "example.package.id";
Package cachedPackage;
bool allowPartial = false;

bool isCached = Package.TryGetCached(packageIdentifier, out cachedPackage, allowPartial);

if (isCached)
{
    // Use the cachedPackage
    Console.WriteLine($"Package found: {cachedPackage.Title}");
}
else
{
    // Handle the case where the package is not found
    Console.WriteLine("Package not found in cache.");
}