[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 ()
|
public override string ToString ()
|
||||||
{
|
{
|
||||||
if (str != null)
|
if (str is null)
|
||||||
return str;
|
str = FromHandle (Handle);
|
||||||
return FromHandle (Handle);
|
return str;
|
||||||
}
|
}
|
||||||
#endif // !COREBUILD
|
#endif // !COREBUILD
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче