How to intersect two strings using Linq in C#

1 Answer

0 votes
using System;
using System.Linq;

class Program
{
    static void Main() {
        string s1 = "c-sharp", s2 = "java c";

        var result = s1.Intersect(s2);
        
        Console.WriteLine(string.Join("", result));
    }
}
   
   
   
   
/*
run:
      
ca
    
*/

 



answered Jul 6, 2023 by avibootz

Related questions

1 answer 126 views
1 answer 109 views
109 views asked Jul 6, 2023 by avibootz
1 answer 162 views
1 answer 138 views
...