1.Action<SmsData> addData = d => SmsService.AddData(d); å¦ä½ç解ï¼
Action<SmsData> addData = d => SmsService.AddData(d); å¦ä½ç解ï¼
å æ解å¦ä¸ï¼
d => SmsService.AddData(d); //转æ¢ä¸
public void temp(SmsData d)
{
SmsService.AddData(d);
}
ä¸èè线ç¨å®å ¨ï¼å次翻è¯ï¼
Action<SmsData> addData = temp;
addData(obj);
public void temp(SmsData d)
{
SmsService.AddData(d);
}
çç¥äºä¸ä¸ªå½æ°ï¼ç¨Lamada表达å¼åç è¿ç§åæ³å¾é¿è§ åé¢ä½ å¨ç¼ç¨çæ¶åè½çå°ä¸å°
è¿ä¸ªæ¯ä¸ä¸ªå§æï¼å¨ä½¿ç¨ Action<T> å§ææ¶ï¼ä¸å¿ æ¾å¼å®ä¹ä¸ä¸ªå°è£ åªæä¸ä¸ªåæ°çæ¹æ³çå§æã
å®ä¹ï¼
public delegate void Action<in T>(T obj)//ç解ææ³åçã
DEMO:
using System;
using System.Windows.Forms;
public class TestAction1
{
public static void Main()
{
Action<string> messageTarget;
if (Environment.GetCommandLineArgs().Length > 1)
messageTarget = ShowWindowsMessage;
else
messageTarget = Console.WriteLine;
messageTarget("Hello,统源周年庆特效源码 World!");
}
private static void ShowWindowsMessage(string message)
{
MessageBox.Show(message);
}
}
山东济南举办“世界认可日”主题活动 推动绿色低碳发展
spring osgi 源码
js vscode源码
活动吧 源码_活动系统源码
近視想做雷射手術又害怕 醫解答「4個常見疑慮」!
喜迎「元旦寶寶」!醫曝今年新生兒恐未達14萬 憂少子化成國安危機