# ResolveAlias

> Try to resolve an alias value using the SearchExpressionRuntime attached to this context. Each frame if asked to resolve a SearchExpression.alias.

## Definition

* **Type:** Method
* **Namespace:** [UnityEditor.Search](/engine/6000.5/script-reference/unityeditor/search.md)
* **Assembly:** UnityEditor

## ResolveAlias(string)

Try to resolve an alias value using the [SearchExpressionRuntime](/engine/6000.5/script-reference/unityeditor/search/searchexpressionruntime.md) attached to this context. Each frame if asked to resolve a [SearchExpression.alias](/engine/6000.5/script-reference/unityeditor/search/searchexpression/alias.md).

```csharp
public string ResolveAlias(string defaultLabel = null)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): If no exeuction frames are present this becomes the default alias to be resolved.

### Returns

| Type                                                           | Description               |
| -------------------------------------------------------------- | ------------------------- |
| [string](https://learn.microsoft.com/dotnet/api/system.string) | Returns a resolved alias. |

### Examples

```csharp
[Description("Returns ids of current selection")]
[SearchExpressionEvaluator(SearchExpressionEvaluationHints.ThreadNotSupported)]
public static IEnumerable<SearchItem> SelectionIds(SearchExpressionContext c)
{
    var entityIds = UnityEditor.Selection.entityIds;
    foreach (var id in entityIds)
    {
        EntityId entityId = id;
        yield return SearchExpression.CreateItem(UnsafeUtility.As<EntityId, ulong>(ref entityId), c.ResolveAlias("selected id"));
    }
}
```

## ResolveAlias(SearchExpression, string)

Try to resolve an alias value using the [SearchExpressionRuntime](/engine/6000.5/script-reference/unityeditor/search/searchexpressionruntime.md) attached to this context. Each frame if asked to resolve a [SearchExpression.alias](/engine/6000.5/script-reference/unityeditor/search/searchexpression/alias.md).

```csharp
public string ResolveAlias(SearchExpression expr, string defaultLabel = null)
```

### Parameters

**** (\[SearchExpression]\(/engine/6000.5/script-reference/unityeditor/search/searchexpression)): Default expression to look to resolve the alias. If null, use the runtime to resolve the alias.**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): If no exeuction frames are present this becomes the default alias to be resolved.

### Returns

| Type                                                           | Description               |
| -------------------------------------------------------------- | ------------------------- |
| [string](https://learn.microsoft.com/dotnet/api/system.string) | Returns a resolved alias. |

### Examples

```csharp
[Description("Returns ids of current selection")]
[SearchExpressionEvaluator(SearchExpressionEvaluationHints.ThreadNotSupported)]
public static IEnumerable<SearchItem> SelectionIds(SearchExpressionContext c)
{
    var entityIds = UnityEditor.Selection.entityIds;
    foreach (var id in entityIds)
    {
        EntityId entityId = id;
        yield return SearchExpression.CreateItem(UnsafeUtility.As<EntityId, ulong>(ref entityId), c.ResolveAlias("selected id"));
    }
}
```
