[corefoundation] Fix `CFString.ToString` to cache the result (#11932)
`CFString` cache the native immutable string into it's `str` field and use it to avoid p/invokes when possible. `ToString` retrieved the string without setting `str` (if `null`) so it missed opportunities to avoid the native calls.
This commit is contained in:
Родитель
447c59db60
Коммит
7dc918ca34
|
@ -217,9 +217,9 @@ namespace CoreFoundation {
|
|||
|
||||
public override string ToString ()
|
||||
{
|
||||
if (str != null)
|
||||
return str;
|
||||
return FromHandle (Handle);
|
||||
if (str is null)
|
||||
str = FromHandle (Handle);
|
||||
return str;
|
||||
}
|
||||
#endif // !COREBUILD
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче