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

Support extension methods #110

Closed
imgen opened this issue Jul 18, 2017 · 2 comments
Closed

Support extension methods #110

imgen opened this issue Jul 18, 2017 · 2 comments

Comments

@imgen
Copy link

imgen commented Jul 18, 2017

When I try to add extension methods, it give me error saying "Extension methods must be defined in top level class". I guess it is because that there is a implicit class wrapping around the code. Is there anyway to walkaround this

@aelij
Copy link
Member

aelij commented Jul 18, 2017

I'm afraid not. This is a limitation's in Roslyn's C# script variant, which RP relies on. I may introduce a mode in the future which would allow creating a full program (with a class and a Main method).

Meanwhile, you can write extension methods as top level methods in the script, as I suggested in this answer.

@aelij aelij closed this as completed Jul 18, 2017
@imgen
Copy link
Author

imgen commented Jul 24, 2017

@aelij thanks for the info

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

2 participants