匿名方法的使用方法
using System;using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace demo2
{
public class TestNoName
{
public delegate void test(string name);
public event test tet;
public void function(string name)
{
if(this.tet!=null)
{
tet(name);
}
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace demo2
{
class Program
{
static void Main(string[] args)
{
TestNoName a = new TestNoName();
a.tet+=delegate(string name)
{
Console.WriteLine("{0}:我是没有方法的委托 ",name);
};
a.function("demo");
Console.ReadKey();
}
}
}
别看错了哟这可是两个类哟 using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace demo2
{
class Program
{
static void Main(string[] args)
{
TestNoName a = new TestNoName();
a.tet += name=>
{
Console.WriteLine("{0}:我是没有方法的委托 ",name);
};
a.function("demo");
Console.ReadKey();
}
}
}
Testing_C# 发表于 2014-8-26 15:59
using System;
using System.Collections.Generic;
using System.Linq;
这个是使用lambada表达式一起的 不知道你现在开始接触ADO实体模型了没? ibcadmin 发表于 2014-8-26 20:53
不知道你现在开始接触ADO实体模型了没?
接触了一点点,会插入数据到数据库和跟新数据库中的数据 Testing_C# 发表于 2014-8-26 21:52
接触了一点点,会插入数据到数据库和跟新数据库中的数据
恩 现在这个比较流行 多掌握点 没用过不知道 ibcadmin 发表于 2014-8-27 09:47
恩 现在这个比较流行 多掌握点
好的谢谢指导 vzxczccc 发表于 2014-8-27 09:49
没用过不知道
以后你会用到的
页:
[1]