© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•16mo ago•
25 replies
SamPerson

Named function magically turns into anonymous method for no clear reason, cannot be used as Action

I am storing a list of delegates, which are added via calls to
DefineFunction(string name, Delegate actualFn)
DefineFunction(string name, Delegate actualFn)
.
I have a method with signature
public void DrawSprite(string sprite, float x, float y, float w, float h, float rot, float grayscale01 = 0)
public void DrawSprite(string sprite, float x, float y, float w, float h, float rot, float grayscale01 = 0)
.

But when I call
DefineFunction
DefineFunction
to add this method to the list, for some reason,
DefineFunction
DefineFunction
takes it in not as a
System.Action
System.Action
or
System.Func
System.Func
derivative like every other call, but as an
<>f__AnonymousDelegate0
<>f__AnonymousDelegate0
type, which cannot later be converted to a
System.Action
System.Action
for invocation.



DrawSprite
DrawSprite
is the only method for which this happens.
I have absolutely no clue why this is happening. It's exactly the same as everything else. It very much is a named function. Does anyone have ideas for things I could try to get to the bottom of this?
image.png
image.png
image.png
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

❔ Anonymous function as method argument?
C#CC# / help
4y ago
✅ Non-invocable member cannot be used like a method
C#CC# / help
3y ago
Non-invocable member cannot be used like a method?
C#CC# / help
4y ago
Non-invocable member 'NotFound' cannot be used like a method.
C#CC# / help
3y ago