• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
 






wulion

 
 

Powered by 博客园
博客园 | 首页 | 新随笔 | 联系 | 订阅 订阅 | 管理

2013年6月26日

XML 中Descendants<T> 方法
摘要: 1.XElement xmlTree = XElement.Parse(@" This is some text where all of the nodes must be concatenated. This is a second sentence. ");IEnumerable elList = from el in xmlTree.Elements("Para").Descendants() select el;foreach (XEleme... 阅读全文
posted @ 2013-06-26 17:21 wulion 阅读(748) 评论(0) 推荐(0)
 
c#扩展方法
摘要: 我经常需要写一些根据对象属性名字来判断这个对象是否有这个属性或者根据属性名获取该属性的值public static class PropertyExtension { public static object GetValueByName(this Person self,string propertyName) { if (self == null) { return self; } Type t = self.GetType(); PropertyInfo p = t.GetProperty(propertyName); return p.GetValue(self, null); } } 阅读全文
posted @ 2013-06-26 10:11 wulion 阅读(130) 评论(0) 推荐(0)
 
Lambda
摘要: x=> x+1deleage(int x){return x+1;}//后面跟着的是语句块x=>{return x+1;} delegate(int x){return x+1;}//输入参数也可以带类型,带类型后别忘记小括号哦(int x) => x+1 delegate(int x){return x+1;}//也可以多个输入参数,逗号分隔,别忘记小括号(x,y) => x+y delegate(int x,int y){return x+y;}//无参的也行() => 1 delegate(){return 1;}使用了Lambda表达式的程序集反编译后,我 阅读全文
posted @ 2013-06-26 09:22 wulion 阅读(176) 评论(0) 推荐(0)