# Retail v2 API - Class CustomAttribute (2.16.0)

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

- [2.16.0 (latest)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Retail.V2/latest/Google.Cloud.Retail.V2.CustomAttribute)
- [2.15.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Retail.V2/2.15.0/Google.Cloud.Retail.V2.CustomAttribute)
- [2.14.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Retail.V2/2.14.0/Google.Cloud.Retail.V2.CustomAttribute)
- [2.13.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Retail.V2/2.13.0/Google.Cloud.Retail.V2.CustomAttribute)
- [2.12.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Retail.V2/2.12.0/Google.Cloud.Retail.V2.CustomAttribute)
- [2.11.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Retail.V2/2.11.0/Google.Cloud.Retail.V2.CustomAttribute)
- [2.10.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Retail.V2/2.10.0/Google.Cloud.Retail.V2.CustomAttribute)
- [2.9.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Retail.V2/2.9.0/Google.Cloud.Retail.V2.CustomAttribute)
- [2.8.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Retail.V2/2.8.0/Google.Cloud.Retail.V2.CustomAttribute)
- [2.7.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Retail.V2/2.7.0/Google.Cloud.Retail.V2.CustomAttribute)
- [2.6.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Retail.V2/2.6.0/Google.Cloud.Retail.V2.CustomAttribute)
- [2.5.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Retail.V2/2.5.0/Google.Cloud.Retail.V2.CustomAttribute)
- [2.4.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Retail.V2/2.4.0/Google.Cloud.Retail.V2.CustomAttribute)
- [2.3.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Retail.V2/2.3.0/Google.Cloud.Retail.V2.CustomAttribute)
- [2.2.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Retail.V2/2.2.0/Google.Cloud.Retail.V2.CustomAttribute)
- [2.1.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Retail.V2/2.1.0/Google.Cloud.Retail.V2.CustomAttribute)
- [2.0.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Retail.V2/2.0.0/Google.Cloud.Retail.V2.CustomAttribute)
- [1.6.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Retail.V2/1.6.0/Google.Cloud.Retail.V2.CustomAttribute)
- [1.5.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Retail.V2/1.5.0/Google.Cloud.Retail.V2.CustomAttribute)
- [1.4.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Retail.V2/1.4.0/Google.Cloud.Retail.V2.CustomAttribute)
- [1.3.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Retail.V2/1.3.0/Google.Cloud.Retail.V2.CustomAttribute)
- [1.2.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Retail.V2/1.2.0/Google.Cloud.Retail.V2.CustomAttribute)
- [1.1.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Retail.V2/1.1.0/Google.Cloud.Retail.V2.CustomAttribute)
- [1.0.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Retail.V2/1.0.0/Google.Cloud.Retail.V2.CustomAttribute)

    public sealed class CustomAttribute : IMessage<CustomAttribute>, IEquatable<CustomAttribute>, IDeepCloneable<CustomAttribute>, IBufferMessage, IMessage

Reference documentation and code samples for the Retail v2 API class CustomAttribute.

A custom attribute that is not explicitly modeled in
\[Product\]\[google.cloud.retail.v2.Product\].

## Inheritance

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

## Implements

[IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage-1.html)[CustomAttribute](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Retail.V2/latest/Google.Cloud.Retail.V2.CustomAttribute), [IEquatable](https://learn.microsoft.com/dotnet/api/system.iequatable-1)[CustomAttribute](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Retail.V2/latest/Google.Cloud.Retail.V2.CustomAttribute), [IDeepCloneable](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IDeepCloneable-1.html)[CustomAttribute](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Retail.V2/latest/Google.Cloud.Retail.V2.CustomAttribute), [IBufferMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IBufferMessage.html), [IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage.html)

## 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.Retail.V2](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Retail.V2/latest/Google.Cloud.Retail.V2)

## Assembly

Google.Cloud.Retail.V2.dll

## Constructors

### CustomAttribute()

    public CustomAttribute()

### CustomAttribute(CustomAttribute)

    public CustomAttribute(CustomAttribute other)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `other` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Retail.V2/latest/Google.Cloud.Retail.V2.CustomAttribute` |

## Properties

### HasIndexable

    [Obsolete]
    public bool HasIndexable { get; }

Gets whether the "indexable" field is set

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

### HasSearchable

    [Obsolete]
    public bool HasSearchable { get; }

Gets whether the "searchable" field is set

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

### Indexable

    [Obsolete]
    public bool Indexable { get; set; }

This field is normally ignored unless
\[AttributesConfig.attribute_config_level\]\[google.cloud.retail.v2.AttributesConfig.attribute_config_level\]
of the \[Catalog\]\[google.cloud.retail.v2.Catalog\] is set to the deprecated
'PRODUCT_LEVEL_ATTRIBUTE_CONFIG' mode. For information about product-level
attribute configuration, see [Configuration
modes](https://cloud.google.com/retail/docs/attribute-config#config-modes).
If true, custom attribute values are indexed, so that they can be filtered,
faceted or boosted in
\[SearchService.Search\]\[google.cloud.retail.v2.SearchService.Search\].

This field is ignored in a \[UserEvent\]\[google.cloud.retail.v2.UserEvent\].

See \[SearchRequest.filter\]\[google.cloud.retail.v2.SearchRequest.filter\],
\[SearchRequest.facet_specs\]\[google.cloud.retail.v2.SearchRequest.facet_specs\]
and
\[SearchRequest.boost_spec\]\[google.cloud.retail.v2.SearchRequest.boost_spec\]
for more details.

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

### Numbers

    public RepeatedField<double> Numbers { get; }

The numerical values of this custom attribute. For example, `[2.3, 15.4]`
when the key is "lengths_cm".

Exactly one of \[text\]\[google.cloud.retail.v2.CustomAttribute.text\] or
\[numbers\]\[google.cloud.retail.v2.CustomAttribute.numbers\] should be set.
Otherwise, an INVALID_ARGUMENT error is returned.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.Collections.RepeatedField-1.htmlhttps://learn.microsoft.com/dotnet/api/system.double` |   |

### Searchable

    [Obsolete]
    public bool Searchable { get; set; }

This field is normally ignored unless
\[AttributesConfig.attribute_config_level\]\[google.cloud.retail.v2.AttributesConfig.attribute_config_level\]
of the \[Catalog\]\[google.cloud.retail.v2.Catalog\] is set to the deprecated
'PRODUCT_LEVEL_ATTRIBUTE_CONFIG' mode. For information about product-level
attribute configuration, see [Configuration
modes](https://cloud.google.com/retail/docs/attribute-config#config-modes).
If true, custom attribute values are searchable by text queries in
\[SearchService.Search\]\[google.cloud.retail.v2.SearchService.Search\].

This field is ignored in a \[UserEvent\]\[google.cloud.retail.v2.UserEvent\].

Only set if type \[text\]\[google.cloud.retail.v2.CustomAttribute.text\] is
set. Otherwise, a INVALID_ARGUMENT error is returned.

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

### Text

    public RepeatedField<string> Text { get; }

The textual values of this custom attribute. For example, `["yellow",
"green"]` when the key is "color".

Empty string is not allowed. Otherwise, an INVALID_ARGUMENT error is
returned.

Exactly one of \[text\]\[google.cloud.retail.v2.CustomAttribute.text\] or
\[numbers\]\[google.cloud.retail.v2.CustomAttribute.numbers\] should be set.
Otherwise, an INVALID_ARGUMENT error is returned.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.Collections.RepeatedField-1.htmlhttps://learn.microsoft.com/dotnet/api/system.string` |   |