0

これはc ++のコードです

List<String^> ^GetCodecs()
{
    List<String^> ^l = gcnew List<String^>;

    String ^s = gcnew String(Encoder_GetFirstCodecName());
    while (!String.IsNullOrEmpty(s))
    {
        l->Add(s);
        s = gcnew String(Encoder_GetNextCodecName());
    }

    return l;
 }

エラーは次の行にあります。

while (!String.IsNullOrEmpty(s))

オン・ザ・ストリング

エラーはすべて文字列に関するものです:

これは警告です:

Warning 1   warning C4832: token '.' is illegal after UDT 'System::String'

エラー:

Error   2   error C2275: 'System::String' : illegal use of this type as an expression
Error   3   error C2228: left of '.IsNullOrEmpty' must have class/struct/union
Error   4   error C1903: unable to recover from previous error(s); stopping compilation
Error   5   IntelliSense: type name is not allowed

どうすれば修正できますか?

4

1 に答える 1

4

は静的関数であるためIsNullOrEmpty、おそらく::演算子を使用して呼び出す必要があります。

while (!String::IsNullOrEmpty(s))
于 2013-05-04T10:13:54.647 に答える