1. use array to replace HashMap when then key is single character

    int[] counts = new int[128]
    foreach(var c in "hello, world!")
        counts[c]++;
    
  2. use x%2!=0 to determine if x is odd, instead of x%2==1, because of -1%2=-1

  3. string format

    This is just a C# string format tips

    // In the format {0,-20} means the first argument has a fixed length 20, 
    //    and the negative sign guarantees the string is printed from left to right.
    string format = "{0,-20} {1,-10}";
    

results matching ""

    No results matching ""