Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
String concat operation (+) vs StringBuilder
//Title of this code //Rextester.Program.Main is the entry point for your code. Don't change it. using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using System.Text; namespace Rextester { public class Program { public static void Main(string[] args) { var s = Console.In.ReadToEnd(); List<string> a = new List<string>(); for(int i=0; i<5000; i++) a.Add(s); //Console.WriteLine(a.Aggregate((x, y) => x+", "+y)); //this is slow as it uses concat operation ("a"+"b") on strings StringBuilder builder = new StringBuilder(); //this is fast foreach(var i in a) builder.Append(i+", "); Console.WriteLine(builder.ToString()); } } }
run
|
edit
|
history
|
help
0
ingresar datos por teclado
Generics
C# Abstract Syntax Tree Example: Simple Pascal Compiler
C# goes Javascriptish (or Pythonish)
time
test
Charan GR
Implementing two interfaces with the same method signature
convert a string of numbers to a list then use a forEach to loop through the list
minimal path for triangle