首页 新闻 赞助 找找看

c# 源代码命名重复

0
悬赏园豆:5 [已解决问题] 解决于 2016-01-11 14:39

在温习事件的时候 在查看源代码发现一个问题?

 

对应的源代码:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication1
{
    class Program
    {
         delegate void CsDemoDelegate(string msg);
        static event  CsDemoDelegate csEvent;
        static void Main(string[] args)
        {
            csEvent += Method;

            if (csEvent != null)
            {
                csEvent.Invoke("xx");
            }
        }

        static void Method(string msg)
        {
            Console.WriteLine(msg);
        }
    }
}

记得学习的时候 第一条 就是变量名不能重复。很是奇怪 他内部怎么就一模一样 名称。

s_p的主页 s_p | 初学一级 | 园豆:138
提问于:2016-01-07 14:16
< >
分享
最佳答案
0

反编译代码!=实际代码,它只是根据中间代码生成的

收获园豆:4
起个名字 | 菜鸟二级 |园豆:377 | 2016-01-07 15:57
其他回答(1)
0

试了一下,好像会报错的呀,

already contains a definition for 'csEvent' 。

导出源码是不是就不是这样子了呢?

----坐等高手

收获园豆:1
| 园豆:780 (小虾三级) | 2016-01-07 15:18
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册