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

Generic error #322

Closed
roll314 opened this issue Jan 18, 2013 · 6 comments
Closed

Generic error #322

roll314 opened this issue Jan 18, 2013 · 6 comments

Comments

@roll314
Copy link

roll314 commented Jan 18, 2013

This code pattern no compile
void MyFun(Action someAction) {
// do somthing
}

But error messages is no.
========== Build: 0 succeeded or up-to-date, 1 failed, 0 skipped ==========

@LucasOromi
Copy link

Try with Delegate and then call Invoke()

void MyFun(Delegate someAction) {
someAction.Invoke();
}

@roll314
Copy link
Author

roll314 commented Jan 19, 2013

Thx, its work.

@roll314
Copy link
Author

roll314 commented Jan 21, 2013

A bit more complicated:

public void MyFun < TData > (Action < TData > onSuccess)
{
// do somthing
}

....

MyFun< string >(delegate(string data)
{
Script.Alert(data);
});

still silent fault compilation

@nikhilk
Copy link
Owner

nikhilk commented Jan 21, 2013

At the moment you cannot declare generic types and methods in your code that is compiled by the script# compiler. You can only declare those types within separate import assemblies that aren't being compiled to script, but rather just containing API declarations.

@roll314
Copy link
Author

roll314 commented Jan 21, 2013

Could you explain your thought?

@nikhilk
Copy link
Owner

nikhilk commented Jan 21, 2013

This is a limitation in the current implementation.

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

3 participants