// // GET: /StringConcat/ public ActionResult Index() { var model = new StringConcatViewModel { NumToConcat = 50 }; model = DoConcat(model); return View(model); }
private StringConcatViewModel DoConcat(StringConcatViewModel model) { var sw = new Stopwatch(); sw.Reset(); sw.Start(); ConcatMultipleStringsUsingFormat(model.NumToConcat); sw.Stop(); model.StringFormatMultipleTicks = sw.ElapsedTicks; sw.Reset(); sw.Start(); ConcatMultipleStringsUsingOperator(model.NumToConcat); sw.Stop(); model.ConcatMultipleTicks = sw.ElapsedTicks; sw.Reset(); sw.Start(); ConcatMultipleStringsUsingStringBuilder(model.NumToConcat); sw.Stop(); model.StringBuilderMultipleTicks = sw.ElapsedTicks; sw.Reset(); sw.Start(); ConcatTwoStringsUsingOperator(); sw.Stop(); model.ConcatTicks = sw.ElapsedTicks; sw.Reset(); sw.Start(); ConcatTwoStringsUsingFormat(); sw.Stop(); model.StringFormatTicks = sw.ElapsedTicks; sw.Reset(); sw.Start(); ConcatTwoStringsUsingStringBuilder(); sw.Stop(); model.StringBuilderTicks = sw.ElapsedTicks; return model; }
public ActionResult Combine(StringConcatViewModel model) { model = DoConcat(model); return View("Index", model); }