共用方式為


IHierarchicalStringDifferenceService Interface

This service has several shortcut methods that compute differences over strings, snapshots, and spans.

Namespace:  Microsoft.VisualStudio.Text.Differencing
Assembly:  Microsoft.VisualStudio.Text.Data (in Microsoft.VisualStudio.Text.Data.dll)

Syntax

'宣告
Public Interface IHierarchicalStringDifferenceService
public interface IHierarchicalStringDifferenceService
public interface class IHierarchicalStringDifferenceService
type IHierarchicalStringDifferenceService =  interface end
public interface IHierarchicalStringDifferenceService

The IHierarchicalStringDifferenceService type exposes the following members.

Methods

  Name Description
Public method DiffSnapshotSpans Calculates the differences between two snapshot spans, using the given difference options.
Public method DiffStrings Calculates the differences between two strings, using the given difference options.

Top

Remarks

This is a MEF component part, and should be imported as follows:

[Import]
Internal IHierarchicalStringDifferenceService hierarchicalService = null;

Differences are computed according to the specified StringDifferenceTypes, starting with the most general type. Line is more general than word, and word is more general than character.

Examples

Given string A:

This is a

line!

and string B:

This is but a

line!

The returned difference collection contains one line difference, which maps to line 1 of each string.

This difference contains one word difference, which is the addition of the words "but" and " ".

See Also

Reference

Microsoft.VisualStudio.Text.Differencing Namespace