诗情寻知己
揽几缕、轻挽起,暮暮朝朝与君语。
随笔 - 39,  文章 - 3,  评论 - 4,  阅读 - 30754
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
static void Main(string[] args)
        {
            int j = 0;
            Console.WriteLine("++ j =>" + (++j));
            //++ j => 1
 
            int s = 0;
            Console.WriteLine("s++ =>" + (s++));
            //s++ =>0
 
            int k = 0;
            Func<int, int> f = (int input) => {
                try
                {
                    k = 10 / input;
                    k++;
                    return k;
                }
                catch (Exception)
                {
                    ++k;
                    return k;
                }
                finally
                {
                    Console.WriteLine("finally,key "+ k +" =>" + (k++) );
                }
            };
 
            Console.WriteLine("key 0 =>" + f(0));
            Console.WriteLine("key 10 =>" + f(1));
            //finally,key 1 =>1
            //key 0 =>1
            //finally,key 11 =>11
            //key 10 =>11
 
 
            int index = 0;
            List<string> colors = new List<string>() { "red", "yellow", "blue" };
            var cdata = colors.Where(c => {
                index++;
                return !c.StartsWith('y');
            }).ToList();
 
            Console.WriteLine("index =>" + (index));
            Console.WriteLine("cdata Count=>" + (cdata.Count));
            Console.WriteLine("index =>" + (index));
 
            //index => 3
            //cdata Count=>2
            //index => 3

  

posted on   诗情寻知己  阅读(13)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 周边上新:园子的第一款马克杯温暖上架
· 分享 3 个 .NET 开源的文件压缩处理库,助力快速实现文件压缩解压功能!
· Ollama——大语言模型本地部署的极速利器
· 使用C#创建一个MCP客户端
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
点击右上角即可分享
微信分享提示