Sdílet prostřednictvím


IGuardedOperations.InvokeBestMatchingFactory Method

Definition

Overloads

InvokeBestMatchingFactory<TExtension,TMetadataView>(IList<Lazy<TExtension,TMetadataView>>, IContentType, IContentTypeRegistryService, Object)

Safely instantiates an extension point whose declared content type metadata is the closest match to the provided target content type.

InvokeBestMatchingFactory<TExtensionFactory,TExtensionInstance, TMetadataView>(IList<Lazy<TExtensionFactory,TMetadataView>>, IContentType, Func<TExtensionFactory,TExtensionInstance>, IContentTypeRegistryService, Object)

Safely invokes a delegate on the extension factory whose declared content type metadata is the best match to the provided target content type.

InvokeBestMatchingFactory<TExtension,TMetadataView>(IList<Lazy<TExtension,TMetadataView>>, IContentType, IContentTypeRegistryService, Object)

Safely instantiates an extension point whose declared content type metadata is the closest match to the provided target content type.

public:
generic <typename TExtension, typename TMetadataView>
 where TMetadataView : Microsoft::VisualStudio::Utilities::IContentTypeMetadata TExtension InvokeBestMatchingFactory(System::Collections::Generic::IList<Lazy<TExtension, TMetadataView> ^> ^ providerHandles, Microsoft::VisualStudio::Utilities::IContentType ^ dataContentType, Microsoft::VisualStudio::Utilities::IContentTypeRegistryService ^ contentTypeRegistryService, System::Object ^ errorSource);
public TExtension InvokeBestMatchingFactory<TExtension,TMetadataView> (System.Collections.Generic.IList<Lazy<TExtension,TMetadataView>> providerHandles, Microsoft.VisualStudio.Utilities.IContentType dataContentType, Microsoft.VisualStudio.Utilities.IContentTypeRegistryService contentTypeRegistryService, object errorSource) where TMetadataView : Microsoft.VisualStudio.Utilities.IContentTypeMetadata;
abstract member InvokeBestMatchingFactory : System.Collections.Generic.IList<Lazy<'Extension, 'MetadataView>> * Microsoft.VisualStudio.Utilities.IContentType * Microsoft.VisualStudio.Utilities.IContentTypeRegistryService * obj -> 'Extension (requires 'MetadataView :> Microsoft.VisualStudio.Utilities.IContentTypeMetadata)
Public Function InvokeBestMatchingFactory(Of TExtension, TMetadataView) (providerHandles As IList(Of Lazy(Of TExtension, TMetadataView)), dataContentType As IContentType, contentTypeRegistryService As IContentTypeRegistryService, errorSource As Object) As TExtension

Type Parameters

TExtension
TMetadataView

Parameters

providerHandles
IList<Lazy<TExtension,TMetadataView>>

Lazy references that will be evaluated.

dataContentType
IContentType

Target content type.

contentTypeRegistryService
IContentTypeRegistryService

Instance of IContentTypeRegistryService which orders content types.

errorSource
Object

Reference to the object that will be blamed for potential exceptions.

Returns

TExtension

The selected element of providerHandles.

Remarks

This class supports the Visual Studio infrastructure and in general is not intended to be used directly from your code.

Applies to

InvokeBestMatchingFactory<TExtensionFactory,TExtensionInstance, TMetadataView>(IList<Lazy<TExtensionFactory,TMetadataView>>, IContentType, Func<TExtensionFactory,TExtensionInstance>, IContentTypeRegistryService, Object)

Safely invokes a delegate on the extension factory whose declared content type metadata is the best match to the provided target content type.

public:
generic <typename TExtensionFactory, typename TExtensionInstance, typename TMetadataView>
 where TExtensionFactory : class where TMetadataView : Microsoft::VisualStudio::Utilities::IContentTypeMetadata TExtensionInstance InvokeBestMatchingFactory(System::Collections::Generic::IList<Lazy<TExtensionFactory, TMetadataView> ^> ^ providerHandles, Microsoft::VisualStudio::Utilities::IContentType ^ dataContentType, Func<TExtensionFactory, TExtensionInstance> ^ getter, Microsoft::VisualStudio::Utilities::IContentTypeRegistryService ^ contentTypeRegistryService, System::Object ^ errorSource);
public TExtensionInstance InvokeBestMatchingFactory<TExtensionFactory,TExtensionInstance,TMetadataView> (System.Collections.Generic.IList<Lazy<TExtensionFactory,TMetadataView>> providerHandles, Microsoft.VisualStudio.Utilities.IContentType dataContentType, Func<TExtensionFactory,TExtensionInstance> getter, Microsoft.VisualStudio.Utilities.IContentTypeRegistryService contentTypeRegistryService, object errorSource) where TExtensionFactory : class where TMetadataView : Microsoft.VisualStudio.Utilities.IContentTypeMetadata;
abstract member InvokeBestMatchingFactory : System.Collections.Generic.IList<Lazy<'ExtensionFactory, 'MetadataView>> * Microsoft.VisualStudio.Utilities.IContentType * Func<'ExtensionFactory, 'ExtensionInstance (requires 'ExtensionFactory : null)> * Microsoft.VisualStudio.Utilities.IContentTypeRegistryService * obj -> 'ExtensionInstance (requires 'ExtensionFactory : null and 'MetadataView :> Microsoft.VisualStudio.Utilities.IContentTypeMetadata)
Public Function InvokeBestMatchingFactory(Of TExtensionFactory As Class, TExtensionInstance As Class, TMetadataView As Class) (providerHandles As IList(Of Lazy(Of TExtensionFactory, TMetadataView)), dataContentType As IContentType, getter As Func(Of TExtensionFactory, TExtensionInstance), contentTypeRegistryService As IContentTypeRegistryService, errorSource As Object) As TExtensionInstance

Type Parameters

TExtensionFactory
TExtensionInstance
TMetadataView

Parameters

providerHandles
IList<Lazy<TExtensionFactory,TMetadataView>>

Lazy references that will be evaluated.

dataContentType
IContentType

Target content type.

getter
Func<TExtensionFactory,TExtensionInstance>

Delegate which constructs an instance of the extension from the best matching element of providerHandles.

contentTypeRegistryService
IContentTypeRegistryService

Instance of IContentTypeRegistryService which orders content types.

errorSource
Object

Reference to the object that will be blamed for potential exceptions.

Returns

TExtensionInstance

The result of getter.

Remarks

This class supports the Visual Studio infrastructure and in general is not intended to be used directly from your code.

Applies to