# TryGet(string, out UniqueStyleString)

> Attempts to retrieve an existing UniqueStyleString from a string value.

## Definition

* **Type:** Method
* **Namespace:** [UnityEngine.UIElements](/engine/6000.6/script-reference/unityengine/uielements.md)
* **Assembly:** UnityEngine.UIElementsModule

## TryGet(string, UniqueStyleString)

```csharp
public static bool TryGet(string value, out UniqueStyleString result)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): The string value that the resulting UniqueStyleString needs to represent**** (\[UniqueStyleString]\(/engine/6000.6/script-reference/unityengine/uielements/uniquestylestring)): A UniqueStyleString that matches the provided value, if any

### Returns

| Type                                                          | Description                                                                  |
| ------------------------------------------------------------- | ---------------------------------------------------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | True if a UniqueStyleString representing the provided value currently exists |

### Remarks

Methods such as [VisualElement.AddToClassList](/engine/6000.6/script-reference/unityengine/uielements/visualelement/addtoclasslist.md) guarantee that the UniqueStyleString exists after the call. If `TryGet` returns false for a given value, then there is no need to call [VisualElement.ClassListContains](/engine/6000.6/script-reference/unityengine/uielements/visualelement/classlistcontains.md) for that same value, as it will necessarily return false. Similarly, there is no need to call [VisualElement.RemoveFromClassList](/engine/6000.6/script-reference/unityengine/uielements/visualelement/removefromclasslist.md) for that value.
