I'm using .Net framework 4.7.3, with Entity Framework and LINQ.

I'm trying to populate a new class from the database with one of two sub-classes using LINQ, but I'm running into an error with the syntax I'm using and wondered how I could possibly get around it.

The error is

> 
> CS8400: Feature 'target-typed conditional expression' is not available in C#7.3
> 
> 
> 

Here's a simplified but complete version:

**LINQ query (The problem):**

```
        return repo.Find() // Proprietary method returning IQueryable<T>
            .Select(x => new PostSnippet
            {
                Route = x.HasParams
                ? new DynamicDbRoute {
                    // Properties
                }
                : new StaticDbRoute {
                    // Properties
                }
            });

```

**Class I'm wanting to populate:**

```
public sealed class PostSnippet
{
    public string AltText { get; internal set; }
    public string AnchorText { get; internal set; }
    public string Image { get; internal set; }
    public int PostCount { get; internal set; }
    public string Title { get; internal set; }
    public IDbRoute Route { get; internal set; }
}

```

**Interface:**

```
public interface IDbRoute
{
    string Url { get; }
}

```

**Class Variants:**

```
internal sealed class DynamicDbRoute : DbRoute, IDbRoute
{
    internal int NodeId { get; set; }
    internal ICollection<RouteParam> RouteParams { get; set; }
    internal string TopicName { get; set; }

    public override string GetRouteUrl()
    {
        // Implementation
    }
}

internal sealed class StaticDbRoute : DbRoute, IDbRoute
{
    public override string GetRouteUrl()
    {
        // Implementation
    }
}

```

**Base class:**

```
internal abstract class DbRoute
{
    private string _url;

    public string Url => _url ?? (_url = GetRouteUrl());

    public string RouteName { get; set; }

    public abstract string GetRouteUrl();
}

```

I'm currently trying to get this to work so it might not be the perfect solution - feel free to chip in - but primarily I need to get a working solution for the query. Any help appreciated