Skip to content

How to work with enum parameters and return values #31

@Dzoay

Description

@Dzoay

I have an interface that I would like to duck type that returns enum types and takes enum types as parameters.
e.g.

public enum Status
{
    Started,
    Running,
    Finished,
}

public class Calculator
{
    public Status Calculate(CalculationType calculationType)
    {
        // ... some very complex calculations
        return Status.Finished;
    }
}

When attempting to call functions like Calculate with an impromtu interface created using ActLike<T> I receiving binding exceptions.
I noticed in the InterfaceDictionaryWrappedTest() mapping int to TestEnum works well but I cannot find a way to create an impromtu interface for something like the example above.
Is there a way to do this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions