StringExtensionsToFileId Method
Converts a file name or path string into a standardized file identifier.
Namespace: GenerativeAIAssembly: GenerativeAI (in GenerativeAI.dll) Version: 2.0.2+aa51399cad6d90cc71158d589a6268608b3c1893
public static string ToFileId(
this string fileName
)
- fileName String
-
The input file name or path. If the string contains a forward slash ('/'), it must
start with "files/" (case-insensitive). Otherwise, the method will prefix
the provided name with "files/".
String
A string formatted as a valid file identifier. If the input string already starts
with "files/" and contains a '/', it will be returned in lowercase.
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).
ArgumentException |
Thrown if the input string contains a '/' but does not start with "files/".
|