当前位置: 首页>>代码示例>>C#>>正文


C# Result.ToString方法代码示例

本文整理汇总了C#中System.Result.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Result.ToString方法的具体用法?C# Result.ToString怎么用?C# Result.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Result的用法示例。


在下文中一共展示了Result.ToString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: KeyRatios

        public void KeyRatios()
        {
            // for calculation check see : https://docs.google.com/spreadsheets/d/1vYEfSleUjF4It_sB-obzRsosTXHEWrdFbhbHDNlNOCM/edit?usp=sharing
            rt = new Results();

            // get some trades
            List<Trade> fills = new List<Trade>(new Trade[] {
                // go long
                new TradeImpl(sym,p,s), // 100 @ $100
                // increase bet
                new TradeImpl(sym,p+inc,s*2),// 300 @ $100.066666
                // take some profits
                new TradeImpl(sym,p+inc*2,s*-1), // 200 @ 100.0666 (profit = 100 * (100.20 - 100.0666) = 13.34) / maxMIU(= 300*100.06666) = .04% ret
                // go flat (round turn)
                new TradeImpl(sym,p+inc*2,s*-2), // 0 @ 0
                // go short
                new TradeImpl(sym,p,s*-2), // -200 @ 100
                // decrease bet
                new TradeImpl(sym,p,s), // -100 @100
                // exit (round turn)
                new TradeImpl(sym,p+inc,s), // 0 @ 0 (gross profit = -0.10*100 = -$10)
                // do another entry
                new TradeImpl(sym,p,s)
            });

            // compute results
            rt = Results.ResultsFromTradeList(fills, g.d);
            // check ratios
#if DEBUG
            g.d(rt.ToString());
#endif
            Assert.AreEqual(-16.413m,rt.SharpeRatio, "bad sharpe ratio");
            Assert.AreEqual(-26.909m, rt.SortinoRatio, "bad sortino ratio");
        }
开发者ID:bluejack2000,项目名称:core,代码行数:34,代码来源:TestResults.cs

示例2: GetBullsAndCowsMatchesFourCowsTest

 public void GetBullsAndCowsMatchesFourCowsTest()
 {
     GameNumber theNumber = new GameNumber(3, 0, 6, 8);
     PlayerGuess playerGuess = new PlayerGuess(8, 6, 0, 3);
     Result expected = new Result(0, 4);
     Result result = GuessChecker.GetBullsAndCowsMatches(playerGuess, theNumber);
     Assert.AreEqual(expected.ToString(), result.ToString());
 }
开发者ID:polinaak,项目名称:Polina-Telerik-Academy,代码行数:8,代码来源:GuessCheckerTest.cs

示例3: GetBullsAndCowsMatchesOneBullTest

 public void GetBullsAndCowsMatchesOneBullTest()
 {
     GameNumber theNumber = new GameNumber(1, 2, 6, 8);
     PlayerGuess playerGuess = new PlayerGuess(4, 2, 9, 3);
     Result expected = new Result(1, 0);
     Result result = GuessChecker.GetBullsAndCowsMatches(playerGuess, theNumber);
     Assert.AreEqual(expected.ToString(), result.ToString());
 }
开发者ID:polinaak,项目名称:Polina-Telerik-Academy,代码行数:8,代码来源:GuessCheckerTest.cs

示例4: Setup

    // 점수, 승패를 전달해주세요.
    public void Setup(int[] prevScores, int[] scores, Result result) {
        Debug.Log("GameWinner:" + result.ToString() + "[" + scores[0] + " - " + scores[1] + "]");
        
        m_result = result;

        //득점 표시 설정.
        string[] names = { "Score0", "Score1" };
        for(int i=0; i < names.Length; ++i){
            Transform scoreTransform = transform.FindChild( names[i] );
            Score s = scoreTransform.GetComponent<Score>();
            s.Setup( prevScores[i], scores[i]);
        }

        //승패 연출.
        if(m_result == Result.Win){
            m_winLose = Instantiate(m_winPrefab) as GameObject;
            m_winLose.transform.parent = transform;
        }
        else if(m_result == Result.Lose){
            m_winLose = Instantiate(m_losePrefab) as GameObject;
            m_winLose.transform.parent = transform;
        }

    }
开发者ID:fotoco,项目名称:006772,代码行数:25,代码来源:ResultScene.cs

示例5: AddDefaultOrdered

	public bool AddDefaultOrdered (Result r, Fingerprint fp, IWarningLogger logger) 
	{
	    if (r == null)
		throw new ArgumentNullException ();
	    
	    if (default_ordered_id < 0) {
		logger.Error (2037, "Trying to add a dependency to the default " + 
			      "ordered argument, but no default ordered argument is defined",
			      r.ToString ());
		return true;
	    }
	    
	    return AddNamed (default_ordered_id, r, fp, -1, logger);
	}
开发者ID:emtees,项目名称:old-code,代码行数:14,代码来源:ArgCollector.cs

示例6: Add

	public bool Add (Result r, Fingerprint fp, IWarningLogger logger) 
	{
	    if (r == null)
		throw new ArgumentNullException ();
	    
	    Type t = r.GetType ();
	    List<int> possible_args = new List<int> ();
	    Type best_match = typeof (Result);
	    
	    for (int i = 0; i < args.Length; i++) {
		Type atype = args[i].Type;
		
		// Cannot add an unnamed arg to an ordered arg
		if ((args[i].Flags & ArgFlags.Ordered) != 0)
		    continue;
		
		// Prune out the egregiously wrong arguments (not even a superclass of the result)
		if (! TypeIs (t, atype))
		    continue;
		
		// Prune out those that have been bettered
		if (! TypeIs (atype, best_match))
		    continue;
		
		// If we've narrowed the type further, we don't want any of the
		// previous vaguer matches.
		if (atype.IsSubclassOf (best_match)) {
		    possible_args.Clear ();
		    best_match = atype;
		}
		     
		possible_args.Add (i);
	    }
	    
	    //Console.WriteLine ("Finished with {0} possible arguments", possible_args.Count);
	    
	    if (possible_args.Count == 1) {
		args[possible_args[0]].AddResult (r, fp, -1);
		return false;
	    }
	    
	    if (possible_args.Count > 0) {
		
		// Several possible choices. Check for a default
		foreach (int aid in possible_args) {
		    if ((args[aid].Flags & ArgFlags.Default) != 0) {
			args[aid].AddResult (r, fp, -1);
			return false;
		    }
		}
		
		// No dice. Ambiguity not tolerated. Ah, computers.
		
		StringBuilder sb = new StringBuilder ();
		sb.AppendFormat ("Ambiguous dependency of type {0} could " +
				 "be one of these arguments:", t);
		foreach (int aid in possible_args)
		    sb.AppendFormat (" {0}", args[aid].Name);
		
		logger.Error (2035, sb.ToString (), r.ToString ());
		return true;
	    }

	    // Maybe this is a composite result, and it has a default?
	    // We recurse here, so we tunnel through the composites
	    // sequentially. It's correct to check at every step, rather
	    // than calling FindCompatible, since we don't know what 
	    // type we're looking for.
	    
	    if (r is CompositeResult) {
		CompositeResult cr = (CompositeResult) r;
		
		if (cr.HasDefault) {
		    // See note above about losing FP info in composite results.
		    // this case happens when we are guessing the arg; te 
		    //logger.Warning (9999, "LOSING FINGERPRINT INFO in AC (2)", r.ToString ());
		    
		    if (Add (cr.Default, null, logger) == false)
			return false;
		    
		    // if that didn't work, continue
		    // and give a warning about the container
		    // Result, not the default.
		}
	    }
	    
	    // Bummer.
	    
	    string s = String.Format ("Dependency {0} of type {1} isn't compatible " +
				      "with any defined arguments.", r, t);
	    logger.Error (2034, s, null);
	    return true;
	}
开发者ID:emtees,项目名称:old-code,代码行数:93,代码来源:ArgCollector.cs

示例7: CreateStream

		internal void CreateStream(Sound sound, string filePath, Modes mode)
		{
			if (sound != null)
			{
				currentResult = Result.Ok;
				IntPtr soundHandle = new IntPtr();

				try
				{
					currentResult = NativeMethods.FMOD_System_CreateStream(handle, filePath, mode, 0, ref soundHandle);
				}
				catch (System.Runtime.InteropServices.ExternalException)
				{
					currentResult = Result.InvalidParameterError;
				}

				if (currentResult == Result.Ok)
				{					
					sound.Handle = soundHandle;
					sound.SoundSystem = this;
				}
				else throw new ApplicationException("could not create stream: " + currentResult.ToString());
			}
			else throw new ArgumentNullException("sound");
		}
开发者ID:bossaia,项目名称:alexandrialibrary,代码行数:25,代码来源:SoundSystem.cs

示例8: OnMultiplayerHost

 private static void OnMultiplayerHost(Result hostResult, MyMultiplayerBase multiplayer)
 {
     if (hostResult == Result.OK)
     {
         Static.StartServer(multiplayer);
     }
     else
     {
         var notification = new MyHudNotification(MyCommonTexts.MultiplayerErrorStartingServer, 10000, MyFontEnum.Red);
         notification.SetTextFormatArguments(hostResult.ToString());
         MyHud.Notifications.Add(notification);
     }
 }
开发者ID:liiir1985,项目名称:SpaceEngineers,代码行数:13,代码来源:MySession.cs

示例9: Translate

 /// <summary>
 /// Translates the given result value.
 /// </summary>
 /// <param name="result"></param>
 /// <returns></returns>
 public string Translate(Result result)
 {
     return Translate("!Result." + result.ToString());
 }
开发者ID:rlmarsh85,项目名称:bloodlines-resurgence,代码行数:9,代码来源:TranslationProvider.cs

示例10: ToString_Always_ShouldReturnMessage

        public void ToString_Always_ShouldReturnMessage()
        {
            // Arrange
            var result = new Result
            {
                Message = "the message"
            };

            // Act
            var toStringResult = result.ToString();

            // Assert
            Assert.AreEqual(result.Message, toStringResult);
        }
开发者ID:htxryan,项目名称:method-result,代码行数:14,代码来源:ResultTests.cs

示例11: OnJoinBattle

        public static void OnJoinBattle(MyGuiScreenProgress progress, Result joinResult, LobbyEnterInfo enterInfo, MyMultiplayerBase multiplayer)
        {
            MyLog.Default.WriteLine(String.Format("Battle lobby join response: {0}, enter state: {1}", joinResult.ToString(), enterInfo.EnterState));

            bool battleCanBeJoined = multiplayer != null && multiplayer.BattleCanBeJoined;
            if (joinResult == Result.OK && enterInfo.EnterState == LobbyEnterResponseEnum.Success && battleCanBeJoined && multiplayer.GetOwner() != MySteam.UserId)
            {
                // Create session with empty world
                Debug.Assert(MySession.Static == null);

                MySession.CreateWithEmptyWorld(multiplayer);
                MySession.Static.Settings.Battle = true;

                progress.CloseScreen();

                MyLog.Default.WriteLine("Battle lobby joined");

                if (MyPerGameSettings.GUI.BattleLobbyClientScreen != null)
                    MyGuiSandbox.AddScreen(MyGuiSandbox.CreateScreen(MyPerGameSettings.GUI.BattleLobbyClientScreen));
                else
                    Debug.Fail("No battle lobby client screen");
            }
            else
            {
                string status = "ServerHasLeft";
                if (joinResult != Result.OK)
                {
                    status = joinResult.ToString();
                }
                else if (enterInfo.EnterState != LobbyEnterResponseEnum.Success)
                {
                    status = enterInfo.EnterState.ToString();
                }
                else if (!battleCanBeJoined)
                {
                    status = "Started battle cannot be joined";
                }

                OnJoinBattleFailed(progress, multiplayer, status);
            }
        }
开发者ID:Krulac,项目名称:SpaceEngineers,代码行数:41,代码来源:MyJoinGameHelper.cs

示例12: SetResult

        internal void SetResult(int column, int row, Result result)
        {
            IsPlaying = true;
            if (Result.MISSION_COMPLETED == result && TotalShips == 0)
            {
                IsWin = true;
                IsPlaying = false;
                IsHit = true;
                return;
            }

            column--;
            row--;
            TotalFires++;
            if (result == Result.HIT || result == Result.MISSION_COMPLETED)
            {

                TotalShips--;
                IsHit = true;
                if (result == Result.MISSION_COMPLETED)
                    IsPlaying = false;
            }
            else
            {
                IsHit = false;

            }
            Board[column, row] = result.ToString();
        }
开发者ID:n4kong,项目名称:code_challenge1,代码行数:29,代码来源:WebDisplay.cs

示例13: Visit

 public override void Visit(Result result)
 {
     WriteLine(result.ToString());
 }
开发者ID:dotJEM,项目名称:json-validation,代码行数:4,代码来源:FailurePathResultVisitorTest.cs

示例14: SetDefault

	public bool SetDefault (int aid, Result r, IWarningLogger logger) 
	{
	    if (aid < 0 || aid >= args.Length) {
		string s = String.Format ("Trying to set default {0} of nonexistant " +
					  "argument ID {1}.", r, aid);
		logger.Error (2042, s, r.ToString ());
		return true;
	    }

	    args[aid].SetDefault (r);
	    return false;
	}
开发者ID:emtees,项目名称:old-code,代码行数:12,代码来源:ArgCollector.cs

示例15: OnJoin

        public static void OnJoin(MyGuiScreenProgress progress, Result joinResult, LobbyEnterInfo enterInfo, MyMultiplayerBase multiplayer)
        {
            // HACK: To hide multiplayer from ME
            //if (!MySandboxGame.Services.SteamService.IsActive || MySandboxGame.Services.SteamService.AppId * 2 == 667900)
            //    return;

            MyLog.Default.WriteLine(String.Format("Lobby join response: {0}, enter state: {1}", joinResult.ToString(), enterInfo.EnterState));

            if (joinResult == Result.OK && enterInfo.EnterState == LobbyEnterResponseEnum.Success && multiplayer.GetOwner() != Sync.MyId)
            {
                DownloadWorld(progress, multiplayer);
            }
            else
            {
                string status = "ServerHasLeft";
                if (joinResult != Result.OK)
                {
                    status = joinResult.ToString();
                }
                else if (enterInfo.EnterState != LobbyEnterResponseEnum.Success)
                {
                    status = enterInfo.EnterState.ToString();
                }

                OnJoinFailed(progress, multiplayer, status);
            }
        }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:27,代码来源:MyJoinGameHelper.cs


注:本文中的System.Result.ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。