当前位置: 首页>>代码示例>>C#>>正文


C# IEnumerable.ThrowIfNull方法代码示例

本文整理汇总了C#中IEnumerable.ThrowIfNull方法的典型用法代码示例。如果您正苦于以下问题:C# IEnumerable.ThrowIfNull方法的具体用法?C# IEnumerable.ThrowIfNull怎么用?C# IEnumerable.ThrowIfNull使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IEnumerable的用法示例。


在下文中一共展示了IEnumerable.ThrowIfNull方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Populate

		public void Populate(
			Type cacheType,
			IEnumerable<Type> requestFilterTypes,
			IEnumerable<Type> responseGeneratorTypes,
			IEnumerable<Type> responseHandlerTypes,
			IEnumerable<Type> errorHandlerTypes,
			Type antiCsrfCookieManagerType,
			Type antiCsrfNonceValidatorType,
			Type antiCsrfResponseGeneratorType)
		{
			cacheType.ThrowIfNull("cacheType");
			requestFilterTypes.ThrowIfNull("requestFilterTypes");
			responseGeneratorTypes.ThrowIfNull("responseGeneratorTypes");
			responseHandlerTypes.ThrowIfNull("responseHandlerTypes");
			errorHandlerTypes.ThrowIfNull("errorHandlerTypes");

			CacheType = cacheType;
			RequestFilterTypes = requestFilterTypes;
			ResponseGeneratorTypes = responseGeneratorTypes;
			ResponseHandlerTypes = responseHandlerTypes;
			ErrorHandlerTypes = errorHandlerTypes;
			AntiCsrfCookieManagerType = antiCsrfCookieManagerType;
			AntiCsrfNonceValidatorType = antiCsrfNonceValidatorType;
			AntiCsrfResponseGeneratorType = antiCsrfResponseGeneratorType;
		}
开发者ID:kelong,项目名称:JuniorRoute,代码行数:25,代码来源:AspNetView.cs

示例2: AspNetDiagnosticConfiguration

		public AspNetDiagnosticConfiguration(
			Type cacheType,
			IEnumerable<Type> requestFilterTypes,
			IEnumerable<Type> responseGeneratorTypes,
			IEnumerable<Type> responseHandlerTypes,
			IEnumerable<Type> errorHandlerTypes,
			Type antiCsrfCookieManagerType = null,
			Type antiCsrfNonceValidatorType = null,
			Type antiCsrfResponseGeneratorType = null)
		{
			cacheType.ThrowIfNull("cacheType");
			requestFilterTypes.ThrowIfNull("requestFilterTypes");
			responseGeneratorTypes.ThrowIfNull("responseGeneratorTypes");
			responseHandlerTypes.ThrowIfNull("responseHandlerTypes");
			errorHandlerTypes.ThrowIfNull("errorHandlerTypes");

			_cacheType = cacheType;
			_requestFilterTypes = requestFilterTypes.ToArray();
			_responseGeneratorTypes = responseGeneratorTypes.ToArray();
			_responseHandlerTypes = responseHandlerTypes.ToArray();
			_errorHandlerTypes = errorHandlerTypes.ToArray();
			_antiCsrfCookieManagerType = antiCsrfCookieManagerType;
			_antiCsrfNonceValidatorType = antiCsrfNonceValidatorType;
			_antiCsrfResponseGeneratorType = antiCsrfResponseGeneratorType;
		}
开发者ID:kelong,项目名称:JuniorRoute,代码行数:25,代码来源:AspNetDiagnosticConfiguration.cs

示例3: Message

        public Message(
			Guid id,
			string name,
			string description,
			Color backgroundColor,
			IEnumerable<IMessagePart> parts,
			EventHandlerCollection eventHandlerCollection = null)
        {
            name.ThrowIfNull("name");
            description.ThrowIfNull("description");
            parts.ThrowIfNull("parts");

            parts = parts.ToArray();

            IMessagePart question = parts.SingleOrDefault(arg => arg is MessageMananger);

            if (question != null && parts.Last() != question)
            {
                throw new ArgumentException("When a MessageQuestion is present, it must be the last part.", "parts");
            }

            _id = id;
            Name = name;
            Description = description;
            _backgroundColor = backgroundColor;
            _parts = parts;
            _eventHandlerCollection = eventHandlerCollection;
        }
开发者ID:tj-miller,项目名称:TextAdventure,代码行数:28,代码来源:Message.cs

示例4: GetRoutes

        public IEnumerable<Routing.Route> GetRoutes(IGuidFactory guidFactory, IUrlResolver urlResolver, IHttpRuntime httpRuntime, string diagnosticsRelativeUrl, IEnumerable<IDiagnosticConfiguration> configurations)
        {
            guidFactory.ThrowIfNull("guidFactory");
            urlResolver.ThrowIfNull("urlResolver");
            diagnosticsRelativeUrl.ThrowIfNull("diagnosticsUrl");
            configurations.ThrowIfNull("configurations");

            string diagnosticsUrl = urlResolver.Absolute(diagnosticsRelativeUrl);

            yield return DiagnosticRouteHelper.Instance.GetViewRoute<DiagnosticsView>(
                "Diagnostics Home View",
                guidFactory,
                diagnosticsRelativeUrl,
                ResponseResources.Diagnostics,
                DiagnosticsViewNamespaces,
                httpRuntime,
                view =>
                    {
                        view.UrlResolver = urlResolver;
                        AddLinks(view, diagnosticsUrl, configurations);
                    });
            yield return DiagnosticRouteHelper.Instance.GetStylesheetRoute("Diagnostics Common CSS", guidFactory, diagnosticsRelativeUrl + "/css/common", ResponseResources.common, httpRuntime);
            yield return DiagnosticRouteHelper.Instance.GetStylesheetRoute("Diagnostics Reset CSS", guidFactory, diagnosticsRelativeUrl + "/css/reset", ResponseResources.reset, httpRuntime);
            yield return DiagnosticRouteHelper.Instance.GetJavaScriptRoute("Diagnostics jQuery JS", guidFactory, diagnosticsRelativeUrl + "/js/jquery", ResponseResources.jquery_1_8_2_min, httpRuntime);

            foreach (IDiagnosticConfiguration arg in configurations)
            {
                foreach (Routing.Route route in arg.GetRoutes(guidFactory, urlResolver, httpRuntime, diagnosticsRelativeUrl))
                {
                    yield return route;
                }
            }
        }
开发者ID:dblchu,项目名称:JuniorRoute,代码行数:33,代码来源:DiagnosticConfigurationRoutes.cs

示例5: IsSetOfKeysUp

        public static bool IsSetOfKeysUp(this KeyboardState keyboardState, IEnumerable<IEnumerable<Keys>> setsOfKeys)
        {
            keyboardState.ThrowIfNull("keyboardState");
            setsOfKeys.ThrowIfNull("setsOfKeys");

            return setsOfKeys.Any(arg => AreAllKeysUp(keyboardState, arg));
        }
开发者ID:tj-miller,项目名称:TextAdventure,代码行数:7,代码来源:KeyboardStateExtensions.cs

示例6: AreAllKeysUp

        public static bool AreAllKeysUp(this KeyboardState keyboardState, IEnumerable<Keys> keys)
        {
            keyboardState.ThrowIfNull("keyboardState");
            keys.ThrowIfNull("keys");

            return keys.All(keyboardState.IsKeyUp);
        }
开发者ID:tj-miller,项目名称:TextAdventure,代码行数:7,代码来源:KeyboardStateExtensions.cs

示例7: Serialize

        public IEnumerable<XElement> Serialize(IEnumerable<IMessagePart> parts)
        {
            parts.ThrowIfNull("parts");

            foreach (IMessagePart part in parts)
            {
                var messageColor = part as MessageColor;
                var messageLineBreak = part as MessageLineBreak;
                var messageQuestion = part as MessageQuestion;
                var messageText = part as MessageText;

                if (messageColor != null)
                {
                    yield return MessageColorSerializer.Instance.Serialize(messageColor);
                }
                else if (messageLineBreak != null)
                {
                    yield return MessageLineBreakSerializer.Instance.Serialize(messageLineBreak);
                }
                else if (messageQuestion != null)
                {
                    yield return MessageQuestionSerializer.Instance.Serialize(messageQuestion);
                }
                else if (messageText != null)
                {
                    yield return MessageTextSerializer.Instance.Serialize(messageText);
                }
                else
                {
                    throw new ArgumentException(String.Format("Unknown message part type '{0}'.", part.GetType().Name));
                }
            }
        }
开发者ID:tj-miller,项目名称:TextAdventure,代码行数:33,代码来源:MessagePartSerializer.cs

示例8: GetResponse

        public ResponseResult GetResponse(HttpRequestBase request, IEnumerable<RouteMatchResult> routeMatchResults)
        {
            request.ThrowIfNull("request");
            routeMatchResults.ThrowIfNull("routeMatchResults");

            return ResponseResult.ResponseGenerated(Response.NotFound());
        }
开发者ID:dblchu,项目名称:JuniorRoute,代码行数:7,代码来源:NotFoundGenerator.cs

示例9: Add

        public RouteCollection Add(IEnumerable<Route> routes)
        {
            routes.ThrowIfNull("routes");

            foreach (Route route in routes)
            {
                if (_routeIds.Contains(route.Id))
                {
                    throw new ArgumentException(String.Format("A route with ID {0} has already been added.", route.Id), "routes");
                }
                if (!_allowDuplicateRouteNames && _routeNames.Contains(route.Name))
                {
                    throw new ArgumentException(String.Format("A route named '{0}' has already been added.", route.Name), "routes");
                }

                _routes.Add(route);
                _routeNames.Add(route.Name);
                if (!_allowDuplicateRouteNames)
                {
                    _routeIds.Add(route.Id);
                }
            }

            return this;
        }
开发者ID:dblchu,项目名称:JuniorRoute,代码行数:25,代码来源:RouteCollection.cs

示例10: DecorateClass

        public void DecorateClass(IResource resource,
                                  string className,
                                  CodeTypeDeclaration resourceClass,
                                  ResourceClassGenerator generator,
                                  string serviceClassName,
                                  IEnumerable<IResourceDecorator> allDecorators)
        {
            resource.ThrowIfNull("resource");
            className.ThrowIfNull("className");
            resourceClass.ThrowIfNull("resourceClass");
            generator.ThrowIfNull("generator");
            serviceClassName.ThrowIfNull("serviceClassName");
            allDecorators.ThrowIfNull("allDecorators");

            if (!resource.IsServiceResource) // Only add subresources of normal resources, not the root resource.
            {
                // Add all subresources.
                foreach (IResource subresource in resource.Resources.Values)
                {
                    // Consider all members in the current class as invalid names.
                    var forbiddenWords = from CodeTypeMember m in resourceClass.Members select m.Name;

                    // Generate and add the subresource.
                    CodeTypeDeclaration decl = GenerateSubresource(
                        subresource, serviceClassName, allDecorators, generator.RequestGenerator,
                        generator.ContainerGenerator, forbiddenWords);
                    resourceClass.Members.Add(decl);
                }
            }
        }
开发者ID:jithuin,项目名称:infogeezer,代码行数:30,代码来源:SubresourceClassDecorator.cs

示例11: Add

        public RouteCollection Add(IEnumerable<Route> routes)
        {
            routes.ThrowIfNull("routes");

            foreach (Route route in routes)
            {
                if (_routesById.ContainsKey(route.Id))
                {
                    throw new ArgumentException(String.Format("A route with ID {0} has already been added.", route.Id), "routes");
                }
                if (!_allowDuplicateRouteNames && _routesByName.ContainsKey(route.Name))
                {
                    throw new ArgumentException(String.Format("A route named '{0}' has already been added.", route.Name), "routes");
                }

                _routesById.Add(route.Id, route);

                List<Route> routeList;

                if (!_routesByName.TryGetValue(route.Name, out routeList))
                {
                    routeList = new List<Route>();
                    _routesByName.Add(route.Name, routeList);
                }
                routeList.Add(route);
            }

            return this;
        }
开发者ID:nathan-alden,项目名称:junior-route,代码行数:29,代码来源:RouteCollection.cs

示例12: GetResponseAsync

        public Task<ResponseResult> GetResponseAsync(HttpContextBase context, IEnumerable<RouteMatchResult> routeMatchResults)
        {
            context.ThrowIfNull("context");
            routeMatchResults.ThrowIfNull("routeMatchResults");

            return ResponseResult.ResponseGenerated(new Response().NotFound()).AsCompletedTask();
        }
开发者ID:nathan-alden,项目名称:junior-route,代码行数:7,代码来源:NotFoundGenerator.cs

示例13: RouteNotMatched

        public static MatchResult RouteNotMatched(IEnumerable<IRestriction> matchedRestrictions, IEnumerable<IRestriction> unmatchedRestrictions)
        {
            matchedRestrictions.ThrowIfNull("matchedRestrictions");
            unmatchedRestrictions.ThrowIfNull("unmatchedRestrictions");

            return new MatchResult(MatchResultType.RouteNotMatched, matchedRestrictions, unmatchedRestrictions, null);
        }
开发者ID:dblchu,项目名称:JuniorRoute,代码行数:7,代码来源:MatchResult.cs

示例14: RouteMatched

        public static MatchResult RouteMatched(IEnumerable<IRestriction> matchedRestrictions, string cacheKey)
        {
            matchedRestrictions.ThrowIfNull("matchedRestrictions");
            cacheKey.ThrowIfNull("cacheKey");

            return new MatchResult(MatchResultType.RouteMatched, matchedRestrictions, null, cacheKey);
        }
开发者ID:dblchu,项目名称:JuniorRoute,代码行数:7,代码来源:MatchResult.cs

示例15: AspNetHttpHandler

		public AspNetHttpHandler(
			IRouteCollection routes,
			ICache cache,
			IEnumerable<IResponseGenerator> responseGenerators,
			IEnumerable<IResponseHandler> responseHandlers,
			IAntiCsrfCookieManager antiCsrfCookieManager,
			IAntiCsrfNonceValidator antiCsrfNonceValidator,
			IAntiCsrfResponseGenerator antiCsrfResponseGenerator)
		{
			routes.ThrowIfNull("routes");
			cache.ThrowIfNull("cache");
			responseGenerators.ThrowIfNull("responseGenerators");
			responseHandlers.ThrowIfNull("responseHandlers");
			antiCsrfCookieManager.ThrowIfNull("antiCsrfSessionManager");
			antiCsrfNonceValidator.ThrowIfNull("antiCsrfTokenValidator");
			antiCsrfResponseGenerator.ThrowIfNull("antiCsrfResponseGenerator");

			_routes = routes;
			_cache = cache;
			_responseGenerators = responseGenerators.ToArray();
			_responseHandlers = responseHandlers.ToArray();
			_antiCsrfCookieManager = antiCsrfCookieManager;
			_antiCsrfNonceValidator = antiCsrfNonceValidator;
			_antiCsrfResponseGenerator = antiCsrfResponseGenerator;
		}
开发者ID:kelong,项目名称:JuniorRoute,代码行数:25,代码来源:AspNetHttpHandler.cs


注:本文中的IEnumerable.ThrowIfNull方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。