Question: I have the following code where `Model.VerticalType` contains string. I want to compare it with an `Enum` but I get error:

Operator '==' cannot be applied to operands of type 'string' and

`DGS.DGSAPI.UI.BusinessModels.Enums.VerticalType.Voice`

```
@if (Model.VerticalType == DGS.DGSAPI.UI.BusinessModels.Enums.VerticalType.Voice)
{
   <img src="@phoneWSource" />
}

```

Answer: 
Call `.ToString()` on the enum value.

```
@if (Model.VerticalType == DGS.DGSAPI.UI.BusinessModels.Enums.VerticalType.Voice.ToString())

```

This will convert the enum to it's name, in this case `Voice`.
Try [`Enum.Parse`](https://msdn.microsoft.com/en-us/library/kxydatf9(v=vs.110).aspx) to convert from string to Enum value:

```
Enum.Parse(typeof(DGS.DGSAPI.UI.BusinessModels.Enums.VerticalType), Model.VerticalType, true) == DGS.DGSAPI.UI.BusinessModels.Enums.VerticalType.Voice

```

`true` means to ignore case while parsing