# Google Cloud Translation v2 API - Class Detection (3.5.0)

<button class="button button-with-icon cloud-select-dropdown__button " aria-haspopup="true">Version latest</button>

- [3.5.0 (latest)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Translation.V2/latest/Google.Cloud.Translation.V2.Detection)
- [3.4.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Translation.V2/3.4.0/Google.Cloud.Translation.V2.Detection)
- [3.3.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Translation.V2/3.3.0/Google.Cloud.Translation.V2.Detection)
- [3.2.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Translation.V2/3.2.0/Google.Cloud.Translation.V2.Detection)
- [3.1.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Translation.V2/3.1.0/Google.Cloud.Translation.V2.Detection)
- [3.0.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Translation.V2/3.0.0/Google.Cloud.Translation.V2.Detection)
- [2.1.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Translation.V2/2.1.0/Google.Cloud.Translation.V2.Detection)

    public sealed class Detection

Reference documentation and code samples for the Google Cloud Translation v2 API class Detection.

A result of detecting the language of a piece of text
via [DetectLanguage(string)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Translation.V2/latest/Google.Cloud.Translation.V2.TranslationClient#Google_Cloud_Translation_V2_TranslationClient_DetectLanguage_System_String_) or
[DetectLanguageAsync(string, CancellationToken)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Translation.V2/latest/Google.Cloud.Translation.V2.TranslationClient#Google_Cloud_Translation_V2_TranslationClient_DetectLanguageAsync_System_String_System_Threading_CancellationToken_),
or the multiple-item equivalents.

## Inheritance

[object](https://learn.microsoft.com/dotnet/api/system.object) \> Detection

## Inherited Members

[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) [object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) [object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)

## Namespace

[Google.Cloud.Translation.V2](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Translation.V2/latest/Google.Cloud.Translation.V2)

## Assembly

Google.Cloud.Translation.V2.dll

## Constructors

### Detection(string, string, float, bool)

    public Detection(string text, string language, float confidence, bool isReliable)

Constructs a new instance.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `text` | `https://learn.microsoft.com/dotnet/api/system.string` The text that was used for the input of language detection. |
| `language` | `https://learn.microsoft.com/dotnet/api/system.string` The detected language code. |
| `confidence` | `https://learn.microsoft.com/dotnet/api/system.single` The confidence of the detection. |
| `isReliable` | `https://learn.microsoft.com/dotnet/api/system.boolean` The reliability of the detection. |

## Properties

### Confidence

    public float Confidence { get; }

The confidence level (between 0 and 1) of the detection.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.single` |   |

### IsReliable

    public bool IsReliable { get; }

The reliability of the detection.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.boolean` |   |

### Language

    public string Language { get; }

The language code for the detected language.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.string` |   |

### Text

    public string Text { get; }

The text that was used for the input of language detection.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.string` |   |