数组中是否包含这个字符串,即arry.Contains(str)?

2026-04-12 00:501阅读0评论SEO问题
  • 内容介绍
  • 文章标签
  • 相关推荐

本文共计102个文字,预计阅读时间需要1分钟。

数组中是否包含这个字符串,即arry.Contains(str)?

csharpusing System;using System.Collections.Generic;using System.Linq;using System.Text;

namespace ConsoleApplication5{ class Program { static void Main(string[] args) { String[] arry={ abcdef, ghijklmn }; String str=abcd; if (arry.Any(s=> s.Contains(str))) { Console.WriteLine(String found in array.); } else { Console.WriteLine(String not found in array.); } } }}


数组中是否包含这个字符串,即arry.Contains(str)?

using System; using System.Collections.Generic; using System.Linq; using System.Text;namespace ConsoleApplication5 { class Program { static void Main(string[] args) { String[] arry =new String[]{"abcdef","ghijklmn"}; String str="abcd"; if (arry.Contains(str)) { Console.WriteLine("A"); } else { Console.WriteLine("B");//B } } } }

本文共计102个文字,预计阅读时间需要1分钟。

数组中是否包含这个字符串,即arry.Contains(str)?

csharpusing System;using System.Collections.Generic;using System.Linq;using System.Text;

namespace ConsoleApplication5{ class Program { static void Main(string[] args) { String[] arry={ abcdef, ghijklmn }; String str=abcd; if (arry.Any(s=> s.Contains(str))) { Console.WriteLine(String found in array.); } else { Console.WriteLine(String not found in array.); } } }}


数组中是否包含这个字符串,即arry.Contains(str)?

using System; using System.Collections.Generic; using System.Linq; using System.Text;namespace ConsoleApplication5 { class Program { static void Main(string[] args) { String[] arry =new String[]{"abcdef","ghijklmn"}; String str="abcd"; if (arry.Contains(str)) { Console.WriteLine("A"); } else { Console.WriteLine("B");//B } } } }