Reputation: 137
This is the code in 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;
}
The error is on the line:
while (!String.IsNullOrEmpty(s))
On the String
The error/s are all about the String:
This is a warning:
Warning 1 warning C4832: token '.' is illegal after UDT 'System::String'
The errors:
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
How can I fix them ?
Upvotes: 0
Views: 1498
Reputation: 7858
Since IsNullOrEmpty
is a static function, you'd probably have to call it using the ::
operator:
while (!String::IsNullOrEmpty(s))
Upvotes: 4