List user-defined type names (UDTs) (C#)
Gets the names of the user-defined types (UDTs) in a keyspace.
|
Ready to write code? See the examples for this method to get started. If you are new to the Data API, check out the quickstart. |
Result
Returns the names of the user-defined types as an unordered list of strings.
Parameters
Use the ListTypeNamesAsync method, which belongs to the Database class.
You can also use ListTypeNames, which is the synchronous version of the method.
Method signature
public Task<IEnumerable<string>> ListTypeNamesAsync(
ListTypeNamesOptions options = null
);
| Name | Type | Summary |
|---|---|---|
|
Optional. General API options for this operation, including the keyspace and timeout. For more information and examples, see Customize API interaction. |
Examples
The following examples demonstrate how to list names of the user-defined types in a keyspace.
using System.Text.Json;
using DataStax.AstraDB.DataApi;
namespace Examples;
public class Program
{
static async Task Main()
{
// Get an existing table
var client = new DataAPIClient();
var database = client.GetDatabase(
"API_ENDPOINT",
"APPLICATION_TOKEN"
);
// List type names
var names = await database.ListTypeNamesAsync();
Console.WriteLine(JsonSerializer.Serialize(names));
}
}
Client reference
For more information, see the client reference.