void CStringTest() { using (profiler.Sample("CString")) { using (profiler.Sample("Format")) { CString gf = string.Format("Number = {0}, Float = {1} String = {2}", 123, 3.148f, "Text"); int x = 10; } using (profiler.Sample("Concat")) { using (CString a = "That's ", b = "a lot", c = " of", d = " strings", e = " to ", f = "concat", g = CString.Join(null, new CString[] { a, b, c, d, e, f })); int x = 10; } using (profiler.Sample("Substring + IndexOf + LastIndexOf")) { using (CString path = "Path/To/Some/File.txt") { int period = path.IndexOf('.'); using (CString ext = path.Substring(period + 1), file = path.Substring(path.LastIndexOf('/') + 1, 4)); int x = 10; } } using (profiler.Sample("Replace (char)")) { using (CString input = "This is some sort of text", replacement = input.Replace('o', '0').Replace('i', '1')); int x = 10; } using (profiler.Sample("Replace (string)")) { using (CString input = "m_This is the is is form of text", replacement = input.Replace("m_", "").Replace("is", "si")); int x = 10; } using (profiler.Sample("Concat + Intern")) { using (CString outsideString1 = CString.Join(null, new CString[] { "I'm ", "long", "gone ", "the ", "by ", "end ", "of ", "this ", "gstring block" }).ToString(), outsideString = string.Intern(CString.Join(null, new CString[] { "I'll ", "be ", "still ", "around ", "here " }).ToString())); int x = 10; } using (profiler.Sample("ToUpper + ToLower")) { using (CString s1 = "Hello", s2 = s1.ToUpper(), s3 = s2 + s1.ToLower()); int x = 10; } if (!bigStringTest) { return; } using (profiler.Sample("BigStringEval")) { using (CString s1 = bigString, s2 = s1 + "hello"); } } }