diff --git a/Core/InteropServices/SafeMemString.cs b/Core/InteropServices/SafeMemString.cs index b3122bba..9a50911c 100644 --- a/Core/InteropServices/SafeMemString.cs +++ b/Core/InteropServices/SafeMemString.cs @@ -177,6 +177,13 @@ namespace Vanara.InteropServices /// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. public override int GetHashCode() => ToString()?.GetHashCode() ?? 0; + /// Assigns a new string to this memory. + /// The string value. This value can be , but its length cannot be greater than the current . + public virtual void Set(string value) + { + StringHelper.Write(value, handle, out _, true, CharSet, Size); + } + /// Returns the string value held by this instance. /// A value held by this instance or null if the handle is invalid. public override string ToString() => IsInvalid ? null : StringHelper.GetString(handle, CharSet, Size);