List<User> distinctList = new ArrayList();User user1 = new User();user1.setId("111");distinctList.add(user1);User user2 = new User();user2.setId("222");distinctList.add(user2);User user3 = new User();user3.setId("333");
/*! Returns a pointer to the object that sent the signal, if called in a slot activated by a signal; otherwise it returns 0. The pointer is valid only during the execution of the slot that calls this function from this object's thread context. The po
using System; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; using System.Reflection; static class LinqExtensions { private static PropertyInfo GetPropertyInfo(Type objType, string name) { var properties = objType
本来需要EF来更新指定的字段,后来在园子里找到了代码 var StateEntry = ((IObjectContextAdapter)dbContext).ObjectContext.ObjectStateManager.GetObjectStateEntry(entity); StateEntry.SetModifiedProperty(property); 今天看Dos.ORM的源码发现了如何找到Lambda表达式里面的属性值 public string GetFieldNameByLam
1.1 Linq介绍 LINQ全称 Language Integrated Query(语言集成查询).为我们提供一种统一的方式来查询和操作各种数据. LINQ to Object:是针对实现了IEnumerable<T>的对象的LINQ: LINQ to SQL:是针对关系数据库的LINQ: LINQ to XML:是针对XML文档的LINQ. LINQ除了提供一个统一的API来操作各种数据,并且为我们提供了编译时类型检查和动态创建查询表达式的能力. LINQ查询时有两种语法可供选择:查询表
[Lambda表达式概述] Lambda表达式支持将代码块作为方法参数,Lambda表达式允许将使用简洁的代码来创建只有一个抽象方法的接口的实例.(这种接口称为函数式接口) [入门实例] package com.Higgin.Lambda; import org.junit.Test; interface Command{ //接口里定义的process封装行为 public void process(int[] target); } class ProcessArray{ public voi
mysql中判断字段为null或者不为null 在mysql中,查询某字段为空时,切记不可用 = null, 而是 is null,不为空则是 is not null select nulcolumn from table; if nuncolumn is null then select 1; else select 2; end if; 执行存储过程 调用过程:call sp_add (1,2,@a);select @a;
Lambda表达式可以简化C#编程的某些方面,用法非常灵活.因此也不容易掌握. 下边是我学Lambda表达式的一点记录. 1.Lambda表达式是与委托紧密联系的.只要有委托参数类型的地方,就可以使用Lambda表达式. Lambda表达式的运算符是=>.运算符左边列举出了需要的参数,右边定义了赋予Lambda变量的方法的实现代码.下面这段代码是一个最简单的使用方法: public class MyLambda{ public void disPlay() { string mid = "