c# - How can you minimize the number of new lines of code (not using a string class methods)? -


private static void main()      {          var stringsone = new[] {"aaa", "bbb", "ccc"};          var sb = new stringbuilder();          foreach (var s in stringsone)          {              sb.append(s + " ");          }          var concat = sb.tostring();           console.writeline(concat.substring(0,concat.length-1));          console.readkey();      }  

you can try this, minimized lines:

        var stringsone = new[] { "aaa", "bbb", "ccc" };         var sb = new stringbuilder();         stringsone.select(p => p).tolist().foreach(q => sb.append(q+" "));         console.writeline(sb); 

no tostring or substring method used


Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -