Skip to content

Cannot use IEnumerable<T> as a TSuccess Type in Try #1

@freneza

Description

@freneza

I created a method where I'd like to return an IEnumerable, but compiler cannot implicitly convert it to try<Exception, IEnumerable>. My code is just:

    public Try<Exception, IEnumerable<Person>> GetAll()
    {
        using (IDbConnection connection = new SqlConnection(ConnectionString))
        {
            try
            {
                return connection.Query<Person>(QueryGetAll); 
            }
            catch(Exception ex)
            {
                return ex;
            }
        }
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions