本文整理汇总了C#中Func.ThrowIfNull方法的典型用法代码示例。如果您正苦于以下问题:C# Func.ThrowIfNull方法的具体用法?C# Func.ThrowIfNull怎么用?C# Func.ThrowIfNull使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Func
的用法示例。
在下文中一共展示了Func.ThrowIfNull方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CompositeContextProviderFactory
/// <summary>
/// Initializes a new instance of the <see cref="CompositeContextProviderFactory"/> class.
/// </summary>
/// <param name="selectionFunction">
/// The selection function.
/// </param>
/// <param name="factories">
/// The factories to combine.
/// </param>
public CompositeContextProviderFactory(Func<IEnumerable<IContextProvider>, Type, IContextProvider> selectionFunction, params IContextProviderFactory[] factories)
{
selectionFunction.ThrowIfNull("selectionFunction");
factories.ThrowIfNull("factories");
this.selectionFunction = selectionFunction;
this.factories = factories;
}
示例2: ExpressionInstanceFactory
/// <summary>
/// Creates a new instance of the <see cref="ExpressionInstanceFactory" /> class.
/// </summary>
/// <exception cref="ArgumentNullException">factory can not be null.</exception>
/// <param name="factory">The factory.</param>
/// <param name="name">The name of the factory.</param>
/// <param name="description">The description of the factory.</param>
public ExpressionInstanceFactory( Func<IMemberInformation, Object> factory, String name = null, String description = null )
: base(name, description)
{
factory.ThrowIfNull( nameof( factory ) );
_factory = factory;
}
示例3: CreateIndex
/// <summary>
/// Create an index with the specified index settings
/// </summary>
public IIndicesResponse CreateIndex(string index, Func<CreateIndexDescriptor, CreateIndexDescriptor> createIndexSelector)
{
index.ThrowIfEmpty("index");
createIndexSelector.ThrowIfNull("createIndexSelector");
var d = createIndexSelector(new CreateIndexDescriptor());
var settings = d._IndexSettings;
return this.CreateIndex(index, settings);
}
示例4: UrlResolver
public UrlResolver(Func<IRouteCollection> routes, IHttpRuntime httpRuntime)
{
routes.ThrowIfNull("routes");
httpRuntime.ThrowIfNull("httpRuntime");
_routes = new Lazy<IRouteCollection>(routes);
_httpRuntime = httpRuntime;
}
示例5: ModelMapper
public ModelMapper(Func<Type, bool> parameterTypeMatchDelegate, IEnumerable<IModelPropertyMapper> propertyMappers)
{
parameterTypeMatchDelegate.ThrowIfNull("parameterTypeMatchDelegate");
propertyMappers.ThrowIfNull("propertyMappers");
_parameterTypeMatchDelegate = parameterTypeMatchDelegate;
_modelPropertyMappers = propertyMappers.ToArray();
}
示例6: TexturedWindowRenderer
protected TexturedWindowRenderer(Func<TextureContent, WindowTexture> getWindowTextureDelegate)
{
getWindowTextureDelegate.ThrowIfNull("getWindowTextureDelegate");
_getWindowTextureDelegate = getWindowTextureDelegate;
BackgroundColor = Color.White;
BorderColor = Color.White;
}
示例7: PutWarmer
/// <inheritdoc />
public IIndicesOperationResponse PutWarmer(string name, Func<PutWarmerDescriptor, PutWarmerDescriptor> selector)
{
selector.ThrowIfNull("selector");
return this.Dispatch<PutWarmerDescriptor, PutWarmerRequestParameters, IndicesOperationResponse>(
d => selector(d.Name(name).AllIndices()),
(p, d) => this.RawDispatch.IndicesPutWarmerDispatch<IndicesOperationResponse>(p, d)
);
}
示例8: ExpressionMemberSelectionRule
/// <summary>
/// Initializes a new instance of the <see cref="ExpressionMemberSelectionRule" /> class.
/// </summary>
/// <exception cref="ArgumentNullException">predicate can not be null.</exception>
/// <param name="predicate">The predicate used to determine if a member matches the rule.</param>
/// <param name="selectionMode">The selection mode to apply.</param>
/// <param name="name">The name of the rule.</param>
/// <param name="description">The description of the rule.</param>
public ExpressionMemberSelectionRule( Func<IMemberInformation, Boolean> predicate, MemberSelectionMode selectionMode, String name = null, String description = null )
: base(name, description)
{
predicate.ThrowIfNull( nameof( predicate ) );
_predicate = predicate;
_selectionMode = selectionMode;
}
示例9: ConcreteTypeConverter
public ConcreteTypeConverter(Type baseType, Func<dynamic, Hit<dynamic>, Type> concreteTypeSelector, IEnumerable<string> partialFields)
{
concreteTypeSelector.ThrowIfNull("concreteTypeSelector");
this._baseType = baseType;
this._concreteTypeSelector = concreteTypeSelector;
this._partialFields = partialFields;
}
示例10: RestoreObservable
/// <inheritdoc />
public IObservable<IRecoveryStatusResponse> RestoreObservable(TimeSpan interval, Func<RestoreDescriptor, RestoreDescriptor> restoreSelector = null)
{
restoreSelector.ThrowIfNull("restoreSelector");
var restoreDescriptor = restoreSelector(new RestoreDescriptor());
var observable = new RestoreObservable(this, restoreDescriptor);
return observable;
}
示例11: PutWarmerAsync
public Task<IIndicesOperationResponse> PutWarmerAsync(string name, Func<PutWarmerDescriptor, PutWarmerDescriptor> selector)
{
selector.ThrowIfNull("selector");
return this.DispatchAsync<PutWarmerDescriptor, PutWarmerQueryString, IndicesOperationResponse, IIndicesOperationResponse>(
d => selector(d.Name(name).AllIndices()),
(p, d) => this.RawDispatch.IndicesPutWarmerDispatchAsync(p, d)
);
}
示例12: SnapshotObservable
/// <inheritdoc />
public IObservable<ISnapshotStatusResponse> SnapshotObservable(TimeSpan interval, Func<SnapshotDescriptor, SnapshotDescriptor> snapshotSelector = null)
{
snapshotSelector.ThrowIfNull("snapshotSelector");
var snapshotDescriptor = snapshotSelector(new SnapshotDescriptor());
var observable = new SnapshotObservable(this, snapshotDescriptor);
return observable;
}
示例13: Map
public void Map(Func<IContainer> container, Type type, MethodInfo method, Routing.Route route)
{
container.ThrowIfNull("container");
type.ThrowIfNull("type");
method.ThrowIfNull("method");
route.ThrowIfNull("route");
route.RespondWithNoContent();
}
示例14: JsonModelMapper
public JsonModelMapper(Func<Type, bool> parameterTypeMatchDelegate, JsonSerializerSettings serializerSettings, DataConversionErrorHandling errorHandling = DataConversionErrorHandling.UseDefaultValue)
{
parameterTypeMatchDelegate.ThrowIfNull("parameterTypeMatchDelegate");
serializerSettings.ThrowIfNull("serializerSettings");
_parameterTypeMatchDelegate = parameterTypeMatchDelegate;
_serializerSettings = serializerSettings;
_errorHandling = errorHandling;
}
示例15: PutTemplateAsync
public Task<IIndicesOperationResponse> PutTemplateAsync(string name, Func<PutTemplateDescriptor, PutTemplateDescriptor> putTemplateSelector)
{
putTemplateSelector.ThrowIfNull("putTemplateSelector");
var descriptor = putTemplateSelector(new PutTemplateDescriptor(this._connectionSettings).Name(name));
return this.DispatchAsync<PutTemplateDescriptor, PutTemplateQueryString, IndicesOperationResponse, IIndicesOperationResponse>(
descriptor,
(p, d) => this.RawDispatch.IndicesPutTemplateDispatchAsync(p, d._TemplateMapping)
);
}