1.扩展方法
实现方法:创建一些helper方法,或者生成子类。
public static class helper
{
public static string MD5Hash(this string s)
{
return System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(s,"MD5");
}
public static bool In(this object o, IEnumerable b)
{
foreach(object obj in b)
{
if(obj==o)
return true;
}
return false;
}
}
// 调用扩展方法
Console.WriteLine("123456".MD5Hash());
Console.WriteLine("1".In(new[]{"1","2","3"}));
2.VS2008正式版Linq中添加删除方法等函数的更改在添加,更新和删除实体对象时,其函数名更改如下。
Beta 2 Name |
RTM Name |
Add |
InsertOnSubmit |
AddAll |
InsertAllOnSubmit |
Remove |
DeleteOnSubmit |
RemoveAll |
DeleteAllOnSubmit |
We have also changed the members of ChangeSet to match these new names:
Beta 2 Name |
RTM Name |
AddedEntities |
Inserts |
RemovedEntities |
Deletes |
ModifiedEntities |
Updates |
参考:http://www.cnblogs.com/126/archive/2007/11/28/976006.html