FeatureCollectionExtensions.GetRequiredFeature Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
GetRequiredFeature(IFeatureCollection, Type) |
Retrieves the requested feature from the collection. Throws an InvalidOperationException if the feature is not present. |
GetRequiredFeature<TFeature>(IFeatureCollection) |
Retrieves the requested feature from the collection. Throws an InvalidOperationException if the feature is not present. |
GetRequiredFeature(IFeatureCollection, Type)
Retrieves the requested feature from the collection. Throws an InvalidOperationException if the feature is not present.
public static object GetRequiredFeature (this Microsoft.AspNetCore.Http.Features.IFeatureCollection featureCollection, Type key);
static member GetRequiredFeature : Microsoft.AspNetCore.Http.Features.IFeatureCollection * Type -> obj
<Extension()>
Public Function GetRequiredFeature (featureCollection As IFeatureCollection, key As Type) As Object
Parameters
- featureCollection
- IFeatureCollection
feature collection
- key
- Type
The feature key.
Returns
The requested feature.
Applies to
GetRequiredFeature<TFeature>(IFeatureCollection)
Retrieves the requested feature from the collection. Throws an InvalidOperationException if the feature is not present.
public static TFeature GetRequiredFeature<TFeature> (this Microsoft.AspNetCore.Http.Features.IFeatureCollection featureCollection);
static member GetRequiredFeature : Microsoft.AspNetCore.Http.Features.IFeatureCollection -> 'Feature
<Extension()>
Public Function GetRequiredFeature(Of TFeature) (featureCollection As IFeatureCollection) As TFeature
Type Parameters
- TFeature
The feature key.
Parameters
- featureCollection
- IFeatureCollection
The IFeatureCollection.
Returns
The requested feature.