dynamic和匿名类和var的混合使用 没提示照样点

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

namespace ConsoleApplication5
{
class Program
{
public static void aa()
{
Console.Write(1);

}

public void aa()
{
Response.Write(1111111111);
}

public delegate void dd();

static void Main(string[] args)
{
dynamic d ;
ArrayList arr = new ArrayList();
for (int i = 0; i < 20000; i++)
{
d = new { Name = i.ToString(), Num = i.ToString()};
arr.Add(d);
}

for (int i = 0; i < arr.Count; i++)
{
var n1 = (arr[0] as dynamic).Name;
var n2 = (arr[0] as dynamic).Num;

}

}

//复习委托

ad = aa;
ad();


}
}

posted on 2015-10-06 12:42  听哥哥的话  阅读(146)  评论(0编辑  收藏  举报

导航