/// <exception cref="ArgumentNullException"> /// <paramref name="safeString" /> is <see langword="null" />. /// </exception> /// <exception cref="ObjectDisposedException"> /// Throws if the SafeString instance is disposed. /// </exception> public void Append(ISafeString safeString) { if (safeString == null) { throw new ArgumentNullException(nameof(safeString)); } EnsureNotDisposed(); for (var i = 0; i < safeString.Length; i++) { Append(safeString.GetAsSafeBytes(i).DeepClone()); } }
/// <inheritdoc /> /// <inheritdoc cref="DisposableBase.ThrowIfDisposed"/> /// <exception cref="ArgumentNullException"><paramref name="safeString" /> is <see langword="null" />. </exception> public async Task AppendAsync(ISafeString safeString) { if (safeString == null) { throw new ArgumentNullException(nameof(safeString)); } ThrowIfDisposed(); for (var i = 0; i < safeString.Length; i++) { var @byte = await safeString.GetAsSafeBytes(i).DeepCloneAsync().ConfigureAwait(false); await AppendAsync(@byte).ConfigureAwait(false); } }
public bool Equals(ISafeString other) { if (other?.Length != Length) { return(false); } for (var i = 0; i < Length; i++) { if (!GetAsSafeBytes(i).Equals(other.GetAsSafeBytes(i))) { return(false); } } return(true); }