Partilhar via


SPContentTypeId.BestMatch Method

Searches a collection of content type identifiers (IDs) and returns the content type ID that most closely matches the specified content type ID.

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: Yes
Available in SharePoint Online

Syntax

'Declaration
Public Shared Function BestMatch ( _
    contentTypeId As SPContentTypeId, _
    contentTypeIdCollection As IEnumerable _
) As SPContentTypeId
'Usage
Dim contentTypeId As SPContentTypeId
Dim contentTypeIdCollection As IEnumerable
Dim returnValue As SPContentTypeId

returnValue = SPContentTypeId.BestMatch(contentTypeId, _
    contentTypeIdCollection)
public static SPContentTypeId BestMatch(
    SPContentTypeId contentTypeId,
    IEnumerable contentTypeIdCollection
)

Parameters

Return Value

Type: Microsoft.SharePoint.SPContentTypeId
The content type ID that mostly closely matches the specified content type ID.

Remarks

The BestMatch method examines each content type ID in the specified collection and returns the ID that most closely matches the ID that is passed in. If the search finds two matches, the shorter content type ID is returned. For example, if 0x0101 is the argument, and the collection contains both 0x010109 and 0x01010901, the method returns 0x010109.

See Also

Reference

SPContentTypeId Structure

SPContentTypeId Members

Microsoft.SharePoint Namespace

BestMatch(SPContentTypeId)