Esempio n. 1
0
 /// <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());
     }
 }
Esempio n. 2
0
 /// <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);
     }
 }
Esempio n. 3
0
 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);
 }