????? ????? ???? ????? ????? ?? "Visual C" #

?????? ????????? ?????? ?????????
???? ???????: 306822 - ??? ???????? ???? ????? ????? ??? ???????.
????? ???? | ?? ????

?? ??? ??????

??????

???? ??? ??????? ???? ????? ????? ??????? ??? ?? StringBuilder ??? ?????? ????? ?????????. ??? ??????? ?? .NET Framework ????? (??? ???? ?????? ???? ??????? ??? ??? ????? ??????). ???? ?????? ?? ??????? ?????? ?? ?????? ??? ???????? ??? ???????? ???? ??? ??????? ??? ?????? ?????? ????? C/C++.

??? ????? ?? .NET Framework

????? ???? ?????? ????? ????? ??? strcat() ?? Visual C/C++ ????? ???? ??? ???? ?????? ?????? "?" ???? ????? ???????? ?? ?????? ??????. ?? ".NET Framework?" ????? immutable; ?? ???? ????? ?? ??????. C# + ????? ???? ??????? ???? ????? ????? ? ??????? ????? ???? ???? ????? ????? ????? ?? ????.

??? ???? ????? .NET Framework ??? ?? StringBuilder ??????? ????? ?????. ????? ??? ??????? ???????? ???? ??? ?? C/C++ ? ???????? ??? ????? ??? ??? ?????? ?????? ???????? (??? ????? ??????) ? ????? ?????. ???? ??????? ??? ?? StringBuilder ??????? ????? ?? ??? ??????? ?? ?????? ??? ?????? ??? ?????.

????? ? ????? ????? ????? ????????

  1. ??? ????? Visual Studio ?? ?? ?????? ????? Visual C# "???? ????" ????.
  2. ?????? ???????? ???????? ??????? ???? ????? += ? ????? ?? StringBuilder concatenations 5000 ?? 30 ????? ?? ?????. ????? ??? ???????? ???????? ??? ????? ?????.
    const int sLen=30, Loops=5000;
    DateTime sTime, eTime;
    int i;
    string sSource = new String('X', sLen);
    string sDest = "";
    // 
    // Time string concatenation.
    // 
    sTime = DateTime.Now;
    for(i=0;i<Loops;i++) sDest += sSource;
    eTime = DateTime.Now;
    Console.WriteLine("Concatenation took " + (eTime - sTime).TotalSeconds + " seconds.");
    // 
    // Time StringBuilder.
    // 
    sTime = DateTime.Now;
    System.Text.StringBuilder sb = new System.Text.StringBuilder((int)(sLen * Loops * 1.1));
    for(i=0;i<Loops;i++) sb.Append(sSource);
    sDest = sb.ToString();
    eTime = DateTime.Now;
    Console.WriteLine("String Builder took " + (eTime - sTime).TotalSeconds + " seconds.");
    // 
    // Make the console window stay open
    // so that you can see the results when running from the IDE.
    // 
    Console.WriteLine();
    Console.Write("Press Enter to finish ... ");
    Console.Read();
    					
  3. ??? ???????. ???? F5 ????? ?? ?? ?????? ???????. ??? ??? ?????? ???? ?????? ????? ????? ??? ???:
    ????? ?????? ????? 6.208928.
    ???? ????? ?????? ???????.

    ???? ????? ??????? ENTER ??????...
  4. ???? ENTER ?????? ????? ??????? ?? ????? ???? ???? ??????.

??????? ??????? ????????

  • ??? ??? ?? ???? ???? ??? ???????? ??? ?? "????? ???" ??? ASPX ?? ??????? ????? ?? ????? ???????? ??? ????? ??? ?????? ???? ?????? ?????? ?????? ?? ????? ?? ?? StringBuilder ?? ????? ???????? ??????? ??? ????? ???? ????? Response.Write ?? ??????? ???????? ????? ?? ??????.
  • ???? ????? ??????? ??? ?? StringBuilder ???????? ????? ?? ????? ?? ??? ????? ??? ?????. ??? ???? ???????? ???? ??????? ??????? ?????? ???????. ?? ???? ????????? ???? ??????? ??? ?? StringBuilder ???? ????? ??????? ???? ??????? ??????? ?? ??????? ???? ??????? +.

?????

??? ?? StringBuilder ??? ?????? ?? ????? ?????? ?? ?????? ????? ?? ???? ?? ??????? ?? ??? ???????. ?????? ??? ???? ?? ?????????? ???? ?? "?? StringBuilder" ?? "??????? ??? ??????".

???????

???? ???????: 306822 - ????? ??? ??????: 11/???/1429 - ??????: 3.0
????? ???
  • Microsoft Visual C# 2005
  • Microsoft Visual C# .NET 2002 Standard Edition
  • Microsoft Visual C# 2008 Express Edition
????? ??????: 
kbmt kbsweptvs2008 kbhowtomaster kbperformance KB306822 KbMtar
????? ????
???: ??? ????? ??? ?????? ???????? ?????? ????? ???? ????? ?????????? ????? ?? ????????? ?????? ????. ???? ???? ?????????? ???? ?? ???????? ???????? ?????? ????????? ????? ????????? ???????? ????? ???????? ?????? ?? ?????? ??? ?? ???????? ???????? ?? ????? ??????? ?????? ??? ??????? ?????? ??. ?????? ?? ???? ??? ??????? ???????? ????? ?? ???? ????? ?????? ??? ????? ??? ????? ??????? ?? ????? ?? ?????? ??? ??? ??????? ??????? ?? ????? ????? ????? ????? ?????. ?? ????? ???? ?????????? ??????? ??? ????? ?? ??????? ?? ????? ?????? ?? ??? ????? ?? ????? ??????? ?? ???????? ?? ??? ???????. ???? ???? ?????????? ???????? ??? ????? ?????? ??????? ??????
???? ??? ????? ??????? ?????? ??????????306822

????? ???????

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com