1.net代码怎么获取第二行的码搭穷游网源码数字字符串
2.Action<SmsData> addData = d => SmsService.AddData(d); å¦ä½ç解ï¼
net代码怎么获取第二行的数字字符串
public static string IgetNumber(string str)
{
return System.Text.RegularExpressions.Regex.Replace(str, @"[^\d{ 2}-]*", "");
}
public static void Main()
{
string a=IgetNumber("武汉房权证字号第-号");
string b=IgetNumber("武汉房权证字号第号");
Console.WriteLine(a);
Console.WriteLine(b);
}
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);
}
}