"c# func vs action" Code Answer's

You're definitely familiar with the best coding language C# that developers use to develop their projects and they get all their queries like "c# func vs action" answered properly. Developers are finding an appropriate answer about c# func vs action related to the C# coding language. By visiting this online portal developers get answers concerning C# codes question like c# func vs action. Enter your desired code related query in the search bar and get every piece of information about C# code related question on c# func vs action. 

c# func vs action

By TheCodeTrooperTheCodeTrooper on Oct 03, 2020
//A Action is a container to set a method for invoking that has no returns 
//where as a Func is a container to set a method for invoking that has returns
//so
//Any Generals or Templates in a Action will always be signiture input params
//Where as to say a function will alway have a output return indicated by the
//last General or Template type and any others will be inputs params.
//Addtionally async invokers (.BeginInvoke) with actions can be fire and forget 
//where as a Funcs must be awaited for the result using the EndInvoke
//example using lambda's (Short handed anonymous methods):
//Actions
Action BasicAction = ()=>{/*does something*/};
Action</*in*/ Type> SingleParamiterizedAction = (x)=>{/*does something*/};
Action</*in*/ Type1, /*in*/ Type2> DoubleParamiterizedAction = (x, y)=>{/*does something*/};
//....
Func</*out*/ TResult> BasicFunc = ()=>{/*does something*/ return TheTResult; };
Func</*in*/ Type,/*out*/ TypeResult> SingleParamiterizedFunc = (x)=>{/*does something*/ return TheTypeResult; };
Func</*in*/ Type1, /*in*/ Type2, /*out*/ TypeResult> DoubleParamiterizedFunc = (x, y)=>{/*does something*/ return TheTypeResult; }
//Usage example
BasicAction.Invoke(); //result of void can not be used
TResult TheResult = BasicFunc(); // result of the methods output can be used.

Add Comment

0

All those coders who are working on the C# based application and are stuck on c# func vs action can get a collection of related answers to their query. Programmers need to enter their query on c# func vs action related to C# code and they'll get their ambiguities clear immediately. On our webpage, there are tutorials about c# func vs action for the programmers working on C# code while coding their module. Coders are also allowed to rectify already present answers of c# func vs action while working on the C# language code. Developers can add up suggestions if they deem fit any other answer relating to "c# func vs action". Visit this developer's friendly online web community, CodeProZone, and get your queries like c# func vs action resolved professionally and stay updated to the latest C# updates. 

C# answers related to "c# func vs action"

View All C# queries

C# queries related to "c# func vs action"

Browse Other Code Languages

CodeProZone