Load file from stream

On this page

To avoid the saving stream as a file, GroupDocs.Comparison allows you to work with file streams directly.

To work with stream, follow these steps:

  1. Obtain file stream.
  2. Pass opened source file stream to the Comparer class constructor or pass opened target file stream to the Add method.

The following code snippet shows how to load file from stream:

using (Stream sourceStream = File.OpenRead("source.docx"))
using (Stream targetStream = File.OpenRead("target.docx"))
{
	using (Comparer comparer = new Comparer(sourceStream))
	{
        comparer.Add(targetStream);
    	comparer.Compare(File.Create("result.docx"));
	}
}

On this page