"Interface name is not valid at this point"

asp.net, c#, entity-framework

Solution

This is `var ret = IEnumerable<decimal>();` just not valid `C#` code, that is.

You may want to do something like:

var ret = new List<decimal>();

Remeber that List, quoting documentation, derives from `IEnumerable<T>` too.

public class List<T> : IList<T>, ICollection<T>, 
    IList, ICollection, IReadOnlyList<T>, IReadOnlyCollection<T>, IEnumerable<T>, 
    IEnumerable

so the code like

public IEnumerable<decimal> SomeOtherKeys
{
    get
    {
        var ret = new List<decimal>();                                          
        // do stuff with ret
        return ret;
    }
}

is perfectly valid.

Problem

``` public IEnumerable<decimal> SomeKeys { get { return dbContext.SomeTable.Select(x=>x.Key); } } public IEnumerable<decimal> SomeOtherKeys { get { var ret = IEnumerable<decimal>(); // interface name is not // valid as this point // do stuff with ret return ret; } } ``` With my current code, I'm getting the exception above. Do I have to return a `List<decimal>`? Or how am I supposed to return the `IEnumerable` or `IQueriable` datatypes?

Original source