Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

action delegate c#

  private void ShowContentThreadSafe(int level)
  {
            
      if (UcView.TreeList.InvokeRequired)
       {
          	UcView.TreeList?.Invoke(new Action1<int>(a => ShowContent(level)));
       }
       else
        	ShowContent(level);
            
   }
Comment

action c#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;

public class ActionDemo : MonoBehaviour {

	void Start(){
		Action<string> SampleAction; //action dont need an explicit delegate to be declared (Action is special kind of delegate which takes parameters but returns nothing)

		SampleAction = PrintMsg;
		SampleAction += delegate(string s) {Debug.Log("from anonymous method : "+s);} ; //using anonymous method
		SampleAction += s => Debug.Log("using lambda expression : "+s); //using lambda expression
		SampleAction ("Hello shrinath");
	}

	void PrintMsg(string msg1){
		Debug.Log ("msg : " + msg1);
	}
}
Comment

C# Action Delegate

//one of three built-in generic delegate types:

static void ConsolePrint(int i)
{
    Console.WriteLine(i);
}

static void Main(string[] args)
{
    Action<int> printActionDel = ConsolePrint;
    printActionDel(10);
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: c# Unit Test IDbContextFactory 
Csharp :: mvc remote validation additional table 
Csharp :: how to add extra window to wpf 
Csharp :: Bitwise Left Shift C# 
Csharp :: pyqt send message to another instance 
Csharp :: c# disable docking sub member in panel 
Csharp :: C# EDSDK control lens 
Csharp :: c# get error message from cmd command 
Csharp :: get datacontext of itemscontrol item c# 
Csharp :: != in f# 
Csharp :: upload file add more size webconfig in asp.net mvc 
Csharp :: you have the following c# code. sb is a a very long string. you need to identify whether a string stored in an object named stringtofind is within the stringbuilder sb object. which code should you use? 
Csharp :: how to know if object with a certain tag exists unity c# 
Csharp :: checkbox on change c# xamarin forms 
Csharp :: iqkeyboardmanagerswift 
Csharp :: edit form item from class C# 
Csharp :: stuck.hypixel.net ip 
Csharp :: how to make a destroy reference in unity 
Csharp :: get child index unity 
Csharp :: C# data base sql 
Csharp :: LINQ return list of unique values with counts 
Csharp :: show a message box in c# 
Csharp :: dictionary and generic class c# 
Csharp :: unity wrap around value 
Csharp :: how to connect google play services in unity 
Csharp :: C# change to different form 
Csharp :: ########## 
Csharp :: How to enumerate an enum 
Csharp :: C# Move Camera Over Terrain Using Touch Input In Unity 3D - Append To Camera 
Csharp :: Find Number of Repetitions of Substring 
ADD CONTENT
Topic
Content
Source link
Name
1+2 =