版权声明:知识来源于智慧与善良并存的师傅们,亦当回报给智慧与善良并存的人们。 https://blog.csdn.net/yushaopu/article/details/82390125
慈心积善融学习,技术愿为有情学。善心速造多好事,前人栽树后乘凉。我今于此写经验,愿见文者得启发。
- .NET Framework : 4.6.1
- ide : visual studio 2017 community
- os : win7 x86_64
- type setting : markdown
- blog : https://blog.csdn.net/yushaopu
- github : https://github.com/GratefulHeartCoder
code
using System;
namespace ConsoleApp
{
class Program
{
public static void SayHello(int num,string name)
{
Console.WriteLine(name + "-" + "SayHello" + "-" + num);
}
public static void SayWorld(int num,string name)
{
Console.WriteLine(name + "-" + "SayWorld" + "-" + num);
}
static void Main(string[] args)
{
/*
此处的Action展开后是这样的,有兴趣的同学可以学习一下,细致入微。
[TypeForwardedFrom("System.Core, Version=3.5.0.0, Culture=Neutral, PublicKeyToken=b77a5c561934e089")]
public delegate void Action<in T1, in T2>(T1 arg1, T2 arg2);
*/
Action<int, string> test = SayHello;
test += SayWorld;
test(1, "心少朴");
Console.ReadKey();
}
}
}
result
心少朴-SayHello-1
心少朴-SayWorld-1
reference
https://www.cnblogs.com/LipeiNet/p/4694225.html
resource
- [文档] https://docs.microsoft.com/zh-cn/dotnet/csharp/
- [规范] https://github.com/dotnet/docs/tree/master/docs/standard/design-guidelines
- [源码] https://referencesource.microsoft.com/
- [平台] https://www.csdn.net/
- [ IDE ] https://visualstudio.microsoft.com/zh-hans/
感恩曾经帮助过 心少朴 的人。
C#优秀,值得学习。.NET Core具有跨平台的能力,值得关注。
Console,WinForm,WPF,ASP.NET,Azure WebJob,WCF,Unity3d,UWP可以适当地了解。
注:此文是自学笔记所生,质量中下等,故要三思而后行。新手到此,不可照搬,应先研究其理象数,待能变通之时,自然跳出深坑。