Answers for "C# actions"


C# actions

//Action is a invokeable container for Mehod or function method 
//that doesnt return anything. They can accept inputs based on the generals 
//that you template on. If you need a return check out the Func Class
Action YourActionProperty = new Action(()=>{/*do something*/});
Action YourActionProperty = ()=>{/*do something*/};
Action<int/*Or some other types followed by others comma seperated*/> 
YourParamitarizedActionProperty =
  (x/*Each Param will be to the comma seperated types*/)=>
  {/*do some with the inputs*/});

// you can invloke them by calling their invokes.
//The last is the basic sycronous way. For a aysnc call uses
//although awaiting is not required should you need to await a aysnc call use

//You can also fill them with defined methods in a class if you wish, 
//but the signatures must match.
Action YourActionDefinedProperty = YourDefinedMethod;
void YourDefinedMethod()
  //do something
Posted by: Guest on October-03-2020

C# Answers by Framework

Browse Popular Code Answers by Language