ContentExtensionsToObjectT Method
Converts the JSON content of a
Content object into an instance of the specified type.
Namespace: GenerativeAIAssembly: GenerativeAI (in GenerativeAI.dll) Version: 2.0.2+aa51399cad6d90cc71158d589a6268608b3c1893
public static T ToObject<T>(
this Content content
)
where T : class
- content Content
- The Content object containing JSON data to be converted.
- T
- The target type to which the JSON content will be deserialized. Must be a class.
TAn instance of type
T if conversion succeeds, or null if no valid JSON data is found or deserialization fails.In Visual Basic and C#, you can call this method as an instance method on any object of type
Content. 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).