當前位置: 首頁>>代碼示例>>C#>>正文


C# Result.Join方法代碼示例

本文整理匯總了C#中System.Result.Join方法的典型用法代碼示例。如果您正苦於以下問題:C# Result.Join方法的具體用法?C# Result.Join怎麽用?C# Result.Join使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Result的用法示例。


在下文中一共展示了Result.Join方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Register

 public static Result Register(String username, String password,Boolean supper)
 {
     Result result = new Result();
     if (string.IsNullOrEmpty(username))
     {
         result.Add("Sorry,管理員賬號不能為空");
     }
     else if (string.IsNullOrEmpty(password))
     {
         result.Add("Sorry,管理員密碼不能為空");
     }
     else
     {
         if (password.Length != 32)
         {
             password = Encryptor.Md5Encryptor32(Encryptor.Md5Encryptor32(password));
         }
         result.Join(System.IO.XMLHelper.AddData(PathHelper.Map("~/xcenter/data/wechat/manager.xml"), "Manager", System.IO.XMLHelper.CreateInsertParameter("Username", username), System.IO.XMLHelper.CreateInsertParameter("Password", password), System.IO.XMLHelper.CreateInsertParameter("Supper", supper ? "true" : "false")));
     }
     return result;
 }
開發者ID:hetykai,項目名稱:weback,代碼行數:21,代碼來源:Sys.cs

示例2: ElasticThreadPool_Multi_Staged_Fibonacci_Min_1_Max_30

        public void ElasticThreadPool_Multi_Staged_Fibonacci_Min_1_Max_30()
        {
            const int test = 4;

            // initialize data structures
            ElasticThreadPool[] stp = new ElasticThreadPool[test];
            Result<int>[] results = new Result<int>[test];
            for(int i = 0; i < test; ++i) {
                stp[i] = new ElasticThreadPool(1, 30);
                results[i] = new Result<int>(TimeSpan.MaxValue, TaskEnv.New(stp[i]));
            }

            // start test
            var sw = Stopwatch.StartNew();
            for(int i = 0; i < results.Length; ++i) {
                _log.DebugFormat("--- FIBONACCI KICK-OFF: {0}", i);
                Fibonacci(stp[i], 30, TimeSpan.Zero, results[i]);
                Thread.Sleep(TimeSpan.FromSeconds(1));
            }
            results.Join(new Result(TimeSpan.MaxValue)).Wait();
            sw.Stop();
            TimeSpan elapsed = sw.Elapsed;

            // check results
            for(int i = 0; i < test; ++i) {
                Assert.AreEqual(832040, results[i].Value, "result {0} did not match", i);
            }
            _log.Debug("Time: " + elapsed);
            _log.Debug("Work items processed: " + _counter);
            for(int i = 0; i < test; ++i) {
                stp[i].Dispose();
                Assert.AreEqual(0, stp[i].WorkItemCount, "WorkQueue[{0}] items", i);
                Assert.AreEqual(0, stp[i].ThreadCount, "WorkQueue[{0}] threads", i);
            }
        }
開發者ID:sdether,項目名稱:DReAM,代碼行數:35,代碼來源:ThreadPoolTests.cs

示例3: Register

        public virtual User Register( User user, Result errors, ISiteConfig sconfig )
        {
            if (isNameReserved( user.Name, sconfig )) {
                errors.Add( lang.get( "exNameFound" ) );
                return null;
            }

            if (isUrlReserved( user.Url, sconfig )) {
                errors.Add( lang.get( "exUrlFound" ) );
                return null;
            }

            if (validateUnique( user, errors ) == false) return null;

            setProfileAndTemplateAndHashPasswork( user, sconfig );
            user.RoleId = sconfig.NormalRoleId;
            Result result = db.insert( user );
            if (result.HasErrors) {
                db.delete( user.Profile );
                errors.Join( result );
                return null;
            }

            if (strUtil.IsNullOrEmpty( user.Url )) {
                user.Url = "user" + user.Id;
                db.update( user, "Url" );
            }

            sendMsg( user, sconfig );

            userIncomeService.InitUserIncome( user );

            if (isFirstUser()) {
                user.RoleId = sconfig.AdministratorId;
                db.update( user, "RoleId" );
            }

            return user;
        }
開發者ID:2014AmethystCat,項目名稱:wojilu,代碼行數:39,代碼來源:UserService.cs


注:本文中的System.Result.Join方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。