Xceed .NET Libraries Documentation
The synchronization algorithm
Welcome to Xceed .NET, .NET Standard and Xamarin Libraries! > Basic Concepts > Synchronization > The synchronization algorithm

The topics in this section present an overview of the algorithm used during synchronization. Examples of how to perform synchronizations can be found in Synchronizing files and folders.

When EasySynchronize or Synchronize is first called, the passed FileSystemItem list is scanned. If PerformRefresh is enabled in a SynchronizationOptions object passed to the synchronization method, the Refresh method is called on each item. The supplied Filter objects, if any, are also applied to each item. All items that the filters reject are removed from the list and will be ignored for the remainder of the process.

Next, the remaining items in the list are scanned and each file is examined. Unless it is specified manually, the master file (among the items in the list) is the file that was most recently modified. The contents and the attributes of the master file are subsequently used to overwrite the contents (if there is a difference) and the attributes of any file older than the master file. The files that are to be overwritten are called the target files.

If all the items in the list are AbstractFolders, a folder synchronization will be performed (see Folder synchronization). If, however, one or more AbstractFiles are found in the list, a file synchronization will be performed (see File synchronization).

Note: The FileSystemItem list supplied to the synchronization methods is safe from modification by the method, as it uses an internal copy.

For details on the parameters accepted by EasySynchronize and Synchronize and the options available for controlling a synchronization, see The synchronization parameters and The synchronization options.