Extension methods

About Monkey 2 Forums Monkey 2 Development Extension methods

This topic contains 5 replies, has 2 voices, and was last updated by  Arjailer 2 years, 9 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #3734

    Arjailer
    Participant

    I can’t get extension methods to work – just doing:

    gives:

    Any ideas what I’m doing wrong?

    #3735

    Arjailer
    Participant

    Hmm … works in a little project of it’s own, but not in the middle of my game project  🙁

    #3736

    Mark Sibly
    Keymaster

    Can you try and put together a runnable example for me to play with?

    #3739

    Arjailer
    Participant

    I’ll try – so far my extension-only project is working fine and my large project gives the MAV on the simplest extension, but I’m not sure what it is about it that causes it.

     

    Related question – any chance of allowing extension overload methods? E.g. an alternative List<T>.Count() method with parameters? At present it compiles the overloaded method but gives “can’t find overload for ‘Count(…)’ with argument types (bool(string))” when you try to call it.

    #3832

    Mark Sibly
    Keymaster

    > any chance of allowing extension overload methods?

    This should be possible eventually. Will be returning to operator to: and extensions soon-ish.

    #3918

    Arjailer
    Participant

    I haven’t been able to track the MAV down yet, but it appears that I can mitigate it by changing the #Include order.

    If I #Include the extension classes at the very end, after all other classes, then they work.

    If I #Include them earlier (e.g. I originally had them in alphabetical order) then I get the MAV.

    But it’s not as simple as just order, as I can also fix the MAV by commenting out some of my other includes, so it’s some combination of my code and #Include order … will keep looking.

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.