{{ !articles[0].partner.isSponsoringArticle ? "Platinum" : "Portal" }} Partner
dotnet,how-to,microsoft,tools,visual studio,function,.net & windows,c-sharp

Self Executing Anonymous Function

Not because it is all that new, but because it took me a while to find it, here’s how to create a self executing anonymous function using CSharp, just like you can do in JavaScript.

   return 0; 

Func<int> says the the delegate will return an integer.  If you need to pass a parameter you can use the alternate form of Func<parameterType,returnType>

delegate() {return 0;} is just basic delegate syntax that I’ve discussed in the past.… Read the rest

This post was originally found at .NET Answers the original article can be found at Self Executing Anonymous Function

Published at DZone with permission of {{ articles[0].authors[0].realName }}, DZone MVB. (source)

Opinions expressed by DZone contributors are their own.

{{ tag }}, {{tag}},

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}
{{ parent.authors[0].realName || parent.author}}

{{ parent.authors[0].tagline || parent.tagline }}

{{ parent.views }} ViewsClicks