Reputation: 2343
I have the following C++/CLI code:
String^ str = gcnew String("", 0, 10);
bool isEmpty = String::IsNullOrEmpty(str);
Why is String::IsNullOrEmpty()
is returning false?
Upvotes: 2
Views: 1718
Reputation: 17444
You are using this constructor (incorrectly):
public String(
char* value,
int startIndex,
int length
)
where
length
Type: System.Int32
The number of characters within value to use.
So, the length of your string is 10, and therefore, not empty.
Upvotes: 2