Search:

Type: Posts; User: KIBO

Search: Search took 0.01 seconds.

  1. Thread: string.Trim

    by KIBO
    Replies
    2
    Views
    1,950

    nvm, the following code prints true for s1 =...

    nvm, the following code prints true for s1 = "test" and false for "test "


    string s1 = "test";
    string s2 = s1.Trim();

    Console.WriteLine(object.ReferenceEquals(s1, s2));
  2. Thread: string.Trim

    by KIBO
    Replies
    2
    Views
    1,950

    string.Trim

    strings are immutable classes, fine

    but consider the Trim function. What happens when Trim finds out theres nothing to trim. Will it do just "return this" or "return new string(this)"
    ??
Results 1 to 2 of 2