Thursday, 15 May 2014

algorithm - How can I get a new array from the second item onwards in c#? -


I originally had this code, which I accidentally thought was what I wanted:

  string firstArg = args [0]; String [] otherArgs = args.Except (new string [] {Args [0]}). ToArray ();  

However, it seems that. In addition to the method the duplicate is removed so if I had to go through the logic of abcc , then the result of the other ARG result bc not Bcc .

How do I get a new array from all elements with all the elements?

Use the method:

  var otherArgs = args.Skip (1) .ToArray ();  

No comments:

Post a Comment