Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't call overloaded methods that have enum parameters #30

Open
1tgr opened this issue Jun 23, 2017 · 0 comments
Open

Can't call overloaded methods that have enum parameters #30

1tgr opened this issue Jun 23, 2017 · 0 comments

Comments

@1tgr
Copy link

1tgr commented Jun 23, 2017

(See also Stack Overflow: https://stackoverflow.com/q/44702930/32133)

For a non-overloaded method, passing an integer works where an enum is expected. When calling an overloaded method, this integer doesn't seem to be enough to push overload resolution in the right direction.

In R:

library(rClr)
clrLoadAssembly('Temp.dll')

# Error in clrNew("Temp.MyClass", as.integer(0)): Type:    System.MissingMethodException
# Message: Constructor on type 'Temp.MyClass' not found.
clrNew('Temp.MyClass', as.integer(0))

# Works
clrNew('Temp.MyClass', 'hello')

And the corresponding C#:

namespace Temp
{
    public enum MyEnum
    {
        First,
        Second
    }

    public class MyClass
    {
        public MyClass(string thing)
        {
        }

        public MyClass(MyEnum thing)
        {
        }
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant