# TryConvertToDouble(SearchItem, out double, string)

> Resolve a selector on an item and try to convert the selected value to a double.

## Definition

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

## TryConvertToDouble(SearchItem, double, string)

```csharp
public static bool TryConvertToDouble(SearchItem item, out double value, string selector = null)
```

### Parameters

**** (\[SearchItem]\(/engine/6000.0/script-reference/unityeditor/search/searchitem)): SearchItem to extract the value from.**** (\[double]\(https\://learn.microsoft.com/dotnet/api/system.double)): Resulting value.**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): Selector use to access an item value. If null, we will use the internal item value.

### Returns

| Type                                                          | Description                                                                  |
| ------------------------------------------------------------- | ---------------------------------------------------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | Returns true if we were able to select the value and convert it to a double. |

### Examples

```csharp
[Description("Returns asset paths corresponding to a list of instance ids")]
[SearchExpressionEvaluator("IdsToPaths", SearchExpressionEvaluationHints.ThreadNotSupported, SearchExpressionType.Iterable)]
public static IEnumerable<SearchItem> IdsToPath(SearchExpressionContext c)
{
    foreach (var idItem in c.args[0].Execute(c))
    {
        if (SearchExpression.TryConvertToDouble(idItem, out var idNum))
        {
            var id = (int)idNum;
            var path = AssetDatabase.GetAssetPath(id);
            if (!string.IsNullOrEmpty(path))
            {
                yield return SearchExpression.CreateItem(path, c.ResolveAlias("asset path"));
            }
        }
    }
}
```
