GIRepository.UnionInfo.get_discriminator

### Method

# GIRepository UnionInfoget_discriminator

since: 2.80

#### Declaration

    GIConstantInfo*
    gi_union_info_get_discriminator (
      GIUnionInfo* info,
      size_t n
    )

#### Description

Obtain the discriminator value assigned for n-th union field, i.e. the n-th union field is the active one if the discriminator contains this constant.

If the union is not discriminated, `NULL` is returned.

Available since: 2.80

#### Parameters

`n`

  Type: `size_t`

  A union field index.

#### Return value

Type: `GIConstantInfo`

The `GIConstantInfo`, or `NULL` if the union is not discriminated. Free it with `gi_base_info_unref()` when done.

The caller of the method takes ownership of the data, and is responsible for freeing it.
The return value can be `NULL`.