using System; using System.Windows.Forms; namespace WindowsApplication1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { string str1 = null; string str2 = null; str1 = "csharp"; str2 = "CSharp"; int result = 0; result = string.Compare(str1, str2); MessageBox.Show(result.ToString()); result = string.Compare(str1, str2, true); MessageBox.Show(result.ToString()); } } }
When you run this C# program first u will get -1 in message box and then 0
No comments:
Post a Comment