# Google Cloud Translation v2 API - Class TranslationResult (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.TranslationResult)
- [3.4.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Translation.V2/3.4.0/Google.Cloud.Translation.V2.TranslationResult)
- [3.3.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Translation.V2/3.3.0/Google.Cloud.Translation.V2.TranslationResult)
- [3.2.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Translation.V2/3.2.0/Google.Cloud.Translation.V2.TranslationResult)
- [3.1.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Translation.V2/3.1.0/Google.Cloud.Translation.V2.TranslationResult)
- [3.0.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Translation.V2/3.0.0/Google.Cloud.Translation.V2.TranslationResult)
- [2.1.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Translation.V2/2.1.0/Google.Cloud.Translation.V2.TranslationResult)

    public sealed class TranslationResult

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

The result of a translation operation.

## Inheritance

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

## 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

### TranslationResult(string, string, string, string, string, TranslationModel?)

    public TranslationResult(string originalText, string translatedText, string detectedSourceLanguage, string specifiedSourceLanguage, string targetLanguage, TranslationModel? model)

Constructs an instance.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `originalText` | `https://learn.microsoft.com/dotnet/api/system.string` The original text. |
| `translatedText` | `https://learn.microsoft.com/dotnet/api/system.string` The translated text. |
| `detectedSourceLanguage` | `https://learn.microsoft.com/dotnet/api/system.string` The source language code detected by the server, if any. |
| `specifiedSourceLanguage` | `https://learn.microsoft.com/dotnet/api/system.string` The source language code specified by the API caller. |
| `targetLanguage` | `https://learn.microsoft.com/dotnet/api/system.string` The target language code. |
| `model` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Translation.V2/latest/Google.Cloud.Translation.V2.TranslationModel` The model used to perform the translation, if known. |

**Remarks** This constructor is for the benefit of testability, in case you wish to provide your own
fake implementation of [TranslationClient](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Translation.V2/latest/Google.Cloud.Translation.V2.TranslationClient).

### TranslationResult(string, string, string, string, string, TranslationModel?, string)

    public TranslationResult(string originalText, string translatedText, string detectedSourceLanguage, string specifiedSourceLanguage, string targetLanguage, TranslationModel? model, string modelName)

Constructs an instance.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `originalText` | `https://learn.microsoft.com/dotnet/api/system.string` The original text. |
| `translatedText` | `https://learn.microsoft.com/dotnet/api/system.string` The translated text. |
| `detectedSourceLanguage` | `https://learn.microsoft.com/dotnet/api/system.string` The source language code detected by the server, if any. |
| `specifiedSourceLanguage` | `https://learn.microsoft.com/dotnet/api/system.string` The source language code specified by the API caller. |
| `targetLanguage` | `https://learn.microsoft.com/dotnet/api/system.string` The target language code. |
| `model` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Translation.V2/latest/Google.Cloud.Translation.V2.TranslationModel` The model used to perform the translation, if known. |
| `modelName` | `https://learn.microsoft.com/dotnet/api/system.string` The name of the model used to perform the translation. |

**Remarks** This constructor is for the benefit of testability, in case you wish to provide your own
fake implementation of [TranslationClient](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Translation.V2/latest/Google.Cloud.Translation.V2.TranslationClient).

## Properties

### DetectedSourceLanguage

    public string DetectedSourceLanguage { get; }

The source language code detected by the server. This may
be null, typically due to the source language being supplied
by the caller.

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

### Model

    public TranslationModel? Model { get; }

The model used to perform the translation, if known and available
as one of the values in [TranslationModel](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Translation.V2/latest/Google.Cloud.Translation.V2.TranslationModel).

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Translation.V2/latest/Google.Cloud.Translation.V2.TranslationModel` |   |

### ModelName

    public string ModelName { get; }

The name of the model used to perform the translation. This may be present
even if [Model](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Translation.V2/latest/Google.Cloud.Translation.V2.TranslationResult#Google_Cloud_Translation_V2_TranslationResult_Model) is null, if a custom model name has been specified
via [AdvancedTranslationClient](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Translation.V2/latest/Google.Cloud.Translation.V2.AdvancedTranslationClient).

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

### OriginalText

    public string OriginalText { get; }

The original text (or HTML) that was translated.

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

### SpecifiedSourceLanguage

    public string SpecifiedSourceLanguage { get; }

The source language code supplied by the caller, if any.

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

### TargetLanguage

    public string TargetLanguage { get; }

The target language code that the text was translated into.

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

### TranslatedText

    public string TranslatedText { get; }

The translated text.

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