---
title: "TermAncestorDescendant"
description: "TermAncestorDescendant"
url: "https://www.contentstack.com/docs/developers/sdks/content-management-sdk/dot-net/reference/termancestordescendant"
product: "Contentstack"
doc_type: "guide"
audience:
  - developers
  - admins
version: "current"
last_updated: "2026-11-22"
---

# TermAncestorDescendant

## TermAncestorDescendant

TermAncestorDescendant holds one term that sits above or below another term in a taxonomy hierarchy. The Ancestors and Descendants lists of [TermModel](/docs/developers/sdks/content-management-sdk/dot-net/reference/termmodel) hold objects of this type.

**When to Use This Class:** Use this class to read the ancestors or descendants of a term as typed objects.

**Conceptual Role:** Acts as a read-only data model for the hierarchy fields of a term. No SDK method takes it as an argument.

**Returns:** TermAncestorDescendant. One term in the hierarchy of another term.

## Properties

Name

Type

Required

Default

Description

Uid

string?

No

null

Term UID. Serialized as uid.

Name

string?

No

null

Display name of the term. Serialized as name.

ParentUid

string?

No

null

UID of the parent term. null at the root level. Serialized as parent\_uid.

Depth

int?

No

null

Level of the term in the hierarchy. Serialized as depth.

ChildrenCount

int?

No

null

Number of child terms. Serialized as children\_count.

ReferencedEntriesCount

int?

No

null

Number of entries that carry the term. Serialized as referenced\_entries\_count.

## Class-Level Notes

**Where the values come from.**

*   The API sets every property. The SDK fills them only when you deserialize a response into TermModel or into this class.
*   ChildrenCount and ReferencedEntriesCount stay null unless the request passed include\_children\_count or include\_referenced\_entries\_count.
*   The API reference does not document the response shape of [Ancestors](/docs/developers/sdks/content-management-sdk/dot-net/reference/term#term-ancestors) and [Descendants](/docs/developers/sdks/content-management-sdk/dot-net/reference/term#term-descendants). Read the body with OpenJsonObjectResponse() and check the keys before you deserialize them.

## Method Index

TermAncestorDescendant has no methods. Read its properties directly.

## Class-Level Snippet

The snippet below fetches a term and prints the ancestors that the term response holds.

```
using System;
using System.Collections.Generic;
using System.Text.Json;
using Contentstack.Management.Core;
using Contentstack.Management.Core.Exceptions;
using Contentstack.Management.Core.Models;

ContentstackClient client = new ContentstackClient("<AUTHTOKEN>");

try
{
    ContentstackResponse response = client.Stack("<API_KEY>").Taxonomy("<TAXONOMY_UID>").Terms("<TERM_UID>").Fetch();
    TermModel? term = response.OpenJsonObjectResponse()["term"]?.Deserialize<TermModel>();

    foreach (TermAncestorDescendant ancestor in term?.Ancestors ?? new List<TermAncestorDescendant>())
    {
        Console.WriteLine($"Depth {ancestor.Depth}: {ancestor.Name} ({ancestor.Uid})");
    }
}
catch (ContentstackErrorException e)
{
    // Thrown when the API rejects the request
    Console.WriteLine($"Request failed: {(int)e.StatusCode} {e.ErrorCode} {e.ErrorMessage}");
}
```

## TermAncestorDescendant | .NET Management SDK | Contentstack

TermAncestorDescendant in the .NET Management SDK holds one term above or below another term in a taxonomy hierarchy, as the API returns it.