How to extract part of the strings from array of strings with C#

1 Answer

0 votes
using System;
using System.Linq;

class Program
{
    static void Main() {
        string[] array = new[] {"c#", "vb", "c", "c++", "java", "python"};
        
        var result = array.Skip(2).Take(3).ToArray();
            
        foreach (string str in result) {
            Console.WriteLine(str);
        }
    }
}




/*
run:

c
c++
java

*/

 



answered Aug 31, 2023 by avibootz

Related questions

1 answer 208 views
1 answer 110 views
1 answer 172 views
1 answer 153 views
1 answer 143 views
...