Replies: 3 comments
-
|
Yes. SafeLP?Str in Vanara.Core is an IDisposable SafeHandle that holds strings in native memory. SafeLPWStr str1 = new(256); // Wide string with capacity of 256 chars.
SafeLPTStr str2 = new("Some random string"); // Auto string with string copied to its memory
SafeLPStr str3 = new((StrPtrAnsi)ptr, true, 128); // Capture an existing IntPtr and manage its disposal and length of 128
string? s = str1; |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
Thanks @dahall , if I don't provide a length does it behave like auto and look for a terminator? |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
Yes, though methods that rely on Length, won't work or will have unpredictable results. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I find myself doing this sort of thing often:
Is there a nice neat Vanara object to handle this for me?
Beta Was this translation helpful? Give feedback.
All reactions