diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2010-01-08 12:17:09 -0800 |
---|---|---|
committer | Andrew Arnott <andrewarnott@gmail.com> | 2010-01-08 12:32:35 -0800 |
commit | db12726ec8f49d04d0269877d915289190fdc5db (patch) | |
tree | 74629792123d31c64eb4814b98f62b3391e5ad33 /src | |
parent | 7ebe7b5ca74d85d4fe6ce4f9e83e29d90163d13b (diff) | |
download | DotNetOpenAuth-db12726ec8f49d04d0269877d915289190fdc5db.zip DotNetOpenAuth-db12726ec8f49d04d0269877d915289190fdc5db.tar.gz DotNetOpenAuth-db12726ec8f49d04d0269877d915289190fdc5db.tar.bz2 |
Work toward being able to back-target to v3.5.
Diffstat (limited to 'src')
-rw-r--r-- | src/DotNetOpenAuth/Messaging/MessagingUtilities.cs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/DotNetOpenAuth/Messaging/MessagingUtilities.cs b/src/DotNetOpenAuth/Messaging/MessagingUtilities.cs index 3764c2f..be5927f 100644 --- a/src/DotNetOpenAuth/Messaging/MessagingUtilities.cs +++ b/src/DotNetOpenAuth/Messaging/MessagingUtilities.cs @@ -316,6 +316,26 @@ namespace DotNetOpenAuth.Messaging { } } +#if !CLR4 + /// <summary> + /// Copies the contents of one stream to another. + /// </summary> + /// <param name="copyFrom">The stream to copy from, at the position where copying should begin.</param> + /// <param name="copyTo">The stream to copy to, at the position where bytes should be written.</param> + /// <returns>The total number of bytes copied.</returns> + /// <remarks> + /// Copying begins at the streams' current positions. + /// The positions are NOT reset after copying is complete. + /// </remarks> + internal static int CopyTo(this Stream copyFrom, Stream copyTo) { + Contract.Requires<ArgumentNullException>(copyFrom != null); + Contract.Requires<ArgumentNullException>(copyTo != null); + Contract.Requires<ArgumentException>(copyFrom.CanRead, MessagingStrings.StreamUnreadable); + Contract.Requires<ArgumentException>(copyTo.CanWrite, MessagingStrings.StreamUnwritable); + return CopyUpTo(copyFrom, copyTo, int.MaxValue); + } +#endif + /// <summary> /// Copies the contents of one stream to another. /// </summary> |