??
if (str1.Length > str2.Length)
{
  ??
}

解决方案 »

  1.   

    string strA,strB;strA ="AAAAAAAAAAAABBBBBBBBB";strB = "Hello wolrd!";if(strA.Length > strB.Length)
    MessageBox.Show("strA is longer than strB");
      

  2.   

    [C#] 
    unsafe
    {
        // Null terminated ASCII characters in an sbyte array
        String szAsciiUpper = null;
        sbyte[] sbArr1 = new sbyte[] { 0x41, 0x42, 0x43, 0x00 };
        // Instruct the Garbage Collector not to move the memory
        fixed(sbyte* pAsciiUpper = sbArr1)
        {
            szAsciiUpper = new String(pAsciiUpper);
        }
        String szAsciiLower = null;
        sbyte[] sbArr2 = { 0x61, 0x62, 0x63, 0x00 };
        // Instruct the Garbage Collector not to move the memory
        fixed(sbyte* pAsciiLower = sbArr2)
        {
            szAsciiLower = new String(pAsciiLower, 0, sbArr2.Length);
        }
        // Prints "ABC abc"
        Console.WriteLine(szAsciiUpper + " " + szAsciiLower);    // Compare Strings - the result is true
        Console.WriteLine("The Strings are equal when capitalized ? " +
            (String.Compare(szAsciiUpper.ToUpper(), szAsciiLower.ToUpper())==0?"true":"false") );    // This is the effective equivalent of another Compare method, which ignores case
        Console.WriteLine("The Strings are equal when capitalized ? " +
            (String.Compare(szAsciiUpper, szAsciiLower, true)==0?"true":"false") );
    }
      

  3.   

    .CompareTo方法
    或者直接两个string ,
    if(str1>str2)
    {
    ...
    }
      

  4.   

    CompareTo 字符比较
    legent长度
      

  5.   

    string strA,strB;strA ="AAAAAAAAAAAABBBBBBBBB";strB = "Hello wolrd!";if(strA > strB)
    MessageBox.Show("strA is longer than strB");
      

  6.   

    string strA,strB;string.Compare(strA,strB);        //区分大小写
    string.Compare(strA,strB,true);   //不区分大小写
      

  7.   

    在VSUAL STUDIO.NET中直接用strA > strB进行比较,编译时出错;错误信息描述为在不能用“<”和“>”进行“string”比较