StringExtensionsToCachedContentId Method

Converts a content name or path string into a standardized cached content identifier.

Definition

Namespace: GenerativeAI
Assembly: GenerativeAI (in GenerativeAI.dll) Version: 2.0.2+aa51399cad6d90cc71158d589a6268608b3c1893
C#
public static string ToCachedContentId(
	this string contentName
)

Parameters

contentName  String
The input content name or path. If the string contains a forward slash ('/'), it must start with "cachedContent/" (case-insensitive). Otherwise, the method will prefix the provided name with "cachedContent/".

Return Value

String
A string formatted as a valid cached content identifier. If the input string already starts with "cachedContent/" and contains a '/', it will be returned in lowercase.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type String. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

Exceptions

ArgumentException Thrown if the input string contains a '/' but does not start with "cachedContent/".

See Also