C#???????: ?????泻????
???????????? ???????[ 2016/6/2 11:20:30 ] ??????????????????? .NET
??????3??????????????????蟹???????????
?????????????????械???????????????????????????蟹??????????????????蟹?????????????????????斜?????????谩????????????械????????????????????????????未???????锟�?
????C#
public delegate string GetStrDelegate();
public class Program
{
public static void Main(string[] args)
{
GetStrDelegate del = Func1;
del += Func2;
del += Func3;
string result = del();
Console.WriteLine(result);
//?????????????
//You called me from Func3
}
public static string Func1()
{
return "You called me from Func1!";
}
public static string Func2()
{
return "You called me from Func2!";
}
public static string Func3()
{
return "You called me from Func3!";
}
}
?????????????????GetInvocationList???????斜??????蟹?????????????????校?????????蟹??????
????C#
public delegate string GetStrDelegate();
public class Program
{
public static void Main(string[] args)
{
GetStrDelegate del = Func1;
del += Func2;
del += Func3;
//?????????????蟹???
Delegate[] delList = del.GetInvocationList();
//????????????????????????
foreach (GetStrDelegate item in delList)
{
//??械?????
string result = item();
Console.WriteLine(result);
//?????????????
//You called me from Func1
//You called me from Func2
//You called me from Func3
}
Console.ReadKey();
}
public static string Func1()
{
return "You called me from Func1";
}
public static string Func2()
{
return "You called me from Func2";
}
public static string Func3()
{
return "You called me from Func3";
}
}
????1.3 ????????
??????????????C#2.0?姹�???????????????????????械????????????????????????????危??????斜??????????????????????????????????伞?
????C#
//step01?????????????
public delegate string ProStrDelegate(string str);
public class Program
{
public static void Main(string[] args)
{
//step02???????????????????卸???
ProStrDelegate del = delegate(string str) { return str.ToUpper(); };
string result = del("KaSlFkaDhkjHe");
Console.WriteLine(result);
Console.ReadKey();
//?????KASLFKAFHKJHE
}
}
??????1?????????????C#???????????????????????谩???????????????????????????
??????2????????????????????????????
????1.??????????????????????梅??????????????
????2.???????????????????????????????????????????谩?
????1.4 Lambda????
????Lambda??????C#3.0?姹�???????????????????????????????????????????????????????????Lambda?????????????????????????
????C#
public delegate string ProStrDelegate(string str);
public class Program
{
public static void Main(string[] args)
{
//???????
//ProStrDelegate del = delegate(string str) { return str.ToUpper(); };
//??1
//ProStrDelegate del1 = (string str) =>{ return str.ToUpper(); };
//??2
//ProStrDelegate del2 = (str) =>{ return str.ToUpper(); };
//??3
ProStrDelegate del3 = str => str.ToUpper();
string result = del3("KaSlFkaDhkjHe");
Console.WriteLine(result);
Console.ReadKey();
//?????KASLFKAFHKJHE
}
}
??????1?????delegate????????”=>”???????????斜???????????????
??????2???????????????????????????????????????斜?小????()???????
??????3????????????械??????????校????????return????????????????{}??
???????????????????????婕�???????????????????SPASVO小??(021-61079698-8054)?????????????????????????
??????
???????C#?械?StringC# Socket???????????????????C#?????????????????????????C#???????C#????????????Log4net??????未????C#?????????????C#?????????????????C#???????????????C#????????????????C#7 ?械?Tuple??????C#??TypeScript - GeneratorC# ?????????绱�??????????C#?械???薪???C#??MySQL?????????渭??效?????写??C#????C++??dll???C#??VS2010????械??????

???路???
??????????????????
2023/3/23 14:23:39???写?貌??????????
2023/3/22 16:17:39????????????????????些??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???路???????路
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11????????
?????????App Bug???????????????????????Jmeter?????????QC??????APP????????????????app?????械????????jenkins+testng+ant+webdriver??????????????JMeter????HTTP???????Selenium 2.0 WebDriver ??????