static public bool Exec <TTrans>(object it, TFunc <TTrans> func, bool needAllTrue) where TTrans : class, IDataTransactionBasic { if (it == null) { return(needAllTrue); } TTrans dataTransaction = it as TTrans; if (dataTransaction != null) { return(func(dataTransaction)); } IList list = it as IList; if (list == null) { return(needAllTrue); } foreach (object item in list) { //needAllTrue=true, 只要有一個是false就return false,default是return true //needAllTrue=false,只要有一個是true就return true,default是return false if (DataTransactionHelper.Exec(item, func, needAllTrue) != needAllTrue) { return(!needAllTrue); } } return(needAllTrue); }