本文讲解如何进行字符串及字符串数组比较方法实例。
实例代码:
using System;
using System.Windows.Forms;
using System.Linq;//添加引用
namespace stringCompareDemo
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
string[] a = new string[2] { "中国", "台湾" };
string[] b = new string[2] { "中国", "台湾" };
string stra = "中国台湾";
string strb = "中国台湾回家";
private void button1_Click(object sender, EventArgs e)
{
if (stra.Equals(strb) ==true)
{
textBox1.Text =