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


C# IDictionary.Any方法代码示例

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


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

示例1: CommandContext

        public CommandContext(IDictionary<string, IEnumerable<string>> propertyErrors, IEnumerable<string> operationErrors)
        {
            PropertyErrors = propertyErrors;
            OperationErrors = operationErrors;

            IsValid = !(operationErrors.Any() || propertyErrors.Any(t => t.Value.Any()));
        }
开发者ID:cilution,项目名称:RuneSlinger,代码行数:7,代码来源:CommandContext.cs

示例2: Send

        public async Task<HttpResponseMessage> Send(HttpMethod method, Uri uri, IDictionary<string, string> requestHeaders, object content)
        {
            requestHeaders = requestHeaders ?? new Dictionary<string, string>() { };

            var httpRequestMessage = new HttpRequestMessage(method, uri)
            {
                Content = GetContent(content, requestHeaders),
            };

            foreach (var header in DefaultRequestHeaders)
            {
                if (requestHeaders.Any(x => x.Key == header.Key))
                    requestHeaders.Remove(header.Key);

                requestHeaders.Add(header.Key, header.Value);
            }

            foreach (var header in requestHeaders)
            {
                if (httpRequestMessage.Headers.Contains(header.Key))
                    httpRequestMessage.Headers.Remove(header.Key);

                httpRequestMessage.Headers.Add(header.Key, header.Value);
            }

            return await _httpClient.SendAsync(httpRequestMessage);
        }
开发者ID:tsteele,项目名称:DalSoft.RestClient,代码行数:27,代码来源:HttpClientWrapper.cs

示例3: Generate

        protected string Generate(IDictionary<int, string> divisibleByLabels, int start, int end)
        {
            if (end <= start)
                throw new ArgumentException("Invalid start and end values.  Start must less than end");

            if (null != divisibleByLabels && divisibleByLabels.Any(x => x.Key == 0))
                throw new ArgumentException("Cannot have a zero divisible by", "divisibleByLabels");

            var returnValue = new StringBuilder();
            for (int i = start; i <= end; i++)
            {
                var line = string.Empty;
                if (null != divisibleByLabels)
                {
                    foreach (var label in divisibleByLabels)
                    {
                        if (i%label.Key == 0)
                            line += label.Value;
                    }
                }

                if (string.IsNullOrEmpty(line))
                    line = i.ToString(CultureInfo.InvariantCulture);
                returnValue.AppendLine(line);
            }

            return returnValue.ToString();
        }
开发者ID:ewok-janitor,项目名称:HeadspringInterview,代码行数:28,代码来源:Generator.cs

示例4: OnNavigatedToAsync

 /// <summary>
 /// 
 /// </summary>
 /// <param name="parameter">FortData containing the Pokestop that we're visiting</param>
 /// <param name="mode"></param>
 /// <param name="suspensionState"></param>
 /// <returns></returns>
 public override async Task OnNavigatedToAsync(object parameter, NavigationMode mode,
     IDictionary<string, object> suspensionState)
 {
     if (suspensionState.Any())
     {
         // Recovering the state
         CurrentPokestop = (FortDataWrapper) suspensionState[nameof(CurrentPokestop)];
         CurrentPokestopInfo = (FortDetailsResponse) suspensionState[nameof(CurrentPokestopInfo)];
         CurrentSearchResponse = (FortSearchResponse) suspensionState[nameof(CurrentSearchResponse)];
     }
     else if (parameter is bool)
     {
         // Navigating from game page, so we need to actually load the Pokestop                  
         Busy.SetBusy(true, "Loading Pokestop");
         CurrentPokestop = (FortDataWrapper)NavigationHelper.NavigationState[nameof(CurrentPokestop)];                
         NavigationHelper.NavigationState.Remove(nameof(CurrentPokestop));
         Logger.Write($"Searching {CurrentPokestop.Id}");                
         CurrentPokestopInfo = await GameClient.GetFort(CurrentPokestop.Id, CurrentPokestop.Latitude, CurrentPokestop.Longitude);
         Busy.SetBusy(false);
         // If timeout is expired we can go to to pokestop page          
         if (CurrentPokestop.CooldownCompleteTimestampMs >= DateTime.UtcNow.ToUnixTime())
         {
             // Timeout is not expired yet, player can't get items from the fort
             SearchInCooldown?.Invoke(null, null);
         }
     }
     await Task.CompletedTask;
 }
开发者ID:C9Kamis,项目名称:PoGo-UWP,代码行数:35,代码来源:SearchPokeStopPageViewModel.cs

示例5: OnNavigatedToAsync

 public override Task OnNavigatedToAsync(object parameter, NavigationMode mode, IDictionary<string, object> state) {
     if (state.Any()) {
         Value = state[nameof(Value)]?.ToString();
         state.Clear();
     }
     return Task.CompletedTask;
 }
开发者ID:hbrgnr,项目名称:SeafileW10,代码行数:7,代码来源:MainPageViewModel.cs

示例6: GetBdmtTitles

 private static string GetBdmtTitles(IDictionary<Language, string> bdmtTitles)
 {
     return !bdmtTitles.Any()
                ? null
                : string.Join(Environment.NewLine,
                              bdmtTitles.Select(pair => string.Format("{0}: {1}", pair.Key.ISO_639_2, pair.Value)));
 }
开发者ID:bdhero,项目名称:bdhero-fat,代码行数:7,代码来源:DiscInfoMetadataPanel.cs

示例7: OnNavigatedToAsync

 public async Task OnNavigatedToAsync(object parameter, NavigationMode mode, IDictionary<string, object> state)
 {
     if (state.Any())
     {
         Sub = JsonConvert.DeserializeObject<SubredditItem>((string)state["sub"]);
         Images = IncrementalSubredditGallery.fromJson((string)state["images"]);
         state.Clear();
     }
     else
     {
         if (mode == NavigationMode.Back)
         {
             if (galleryMetaInfo == null)
             {
                 galleryMetaInfo = BootStrapper.Current.SessionState["GalleryInfo"] as GalleryMetaInfo;
                 Images = galleryMetaInfo?.Gallery as IncrementalSubredditGallery;
                 var sub = (await Reddits.SearchSubreddits(Images.Subreddit)).First(s => s.Data.DisplayName == Images.Subreddit);
                 Sub = new SubredditItem(sub);
             }
             ImageSelectedIndex = galleryMetaInfo?.SelectedIndex ?? 0;
         }
         else
         {
             Activate(parameter);
         }
     }
     await Task.CompletedTask;
 }
开发者ID:akshay2000,项目名称:MonocleGiraffe,代码行数:28,代码来源:SubGalleryPageViewModel.cs

示例8: ClearColumnsExcept

        /// <summary>
        /// Clears all columns from the parts list, except the ones that appear in a specified collection.
        /// </summary>
        /// <param name="partsList">The <see cref="PartsList"/> instance that this extension method affects.</param>
        /// <param name="columnIdsToKeep">A dictionary of IDs of <see cref="PropertyTypeEnum.kFileProperty"/> columns
        /// that shouldn't be removed.</param>
        /// <param name="propertyTypesToKeep"></param>
        /// <exception cref="ArgumentNullException"><paramref name="partsList"/> is <c>null</c>.</exception>
        public static void ClearColumnsExcept(
            this PartsList partsList,
            IDictionary<string, int> columnIdsToKeep,
            params PropertyTypeEnum[] propertyTypesToKeep
        )
        {
            if (partsList == null)
                throw new ArgumentNullException(nameof(partsList));

            foreach (PartsListColumn column in partsList.PartsListColumns)
            {
                if (column.PropertyType == PropertyTypeEnum.kFileProperty)
                {
                    var filePropertyId = column.GetFilePropertyId();

                    if (columnIdsToKeep != null &&
                        columnIdsToKeep.Any(x => x.Key == filePropertyId.Key && x.Value == filePropertyId.Value))
                        continue;
                }
                else if (propertyTypesToKeep != null && propertyTypesToKeep.Contains(column.PropertyType))
                    continue;

                column.Remove();
            }
        }
开发者ID:stevenvolckaert,项目名称:autodesk-inventor-powertools,代码行数:33,代码来源:PartsListExtensions.cs

示例9: ParseContentHeaders

        private Tuple<string, Encoding> ParseContentHeaders(IDictionary<string, string> headers)
        {
            string contentType = null;
            Encoding encoding = null;

            if (headers != null && headers.Any())
            {
                foreach (var header in headers)
                {
                    if (header.Key.Equals("Content-Type", StringComparison.InvariantCultureIgnoreCase))
                    {
                        var contentTypeHeaderSplit = header.Value.Split(';');
                        contentType = contentTypeHeaderSplit.First().Trim().ToLower();

                        var encodingString = contentTypeHeaderSplit.FirstOrDefault(x => x.Contains("charset="));
                        if (!String.IsNullOrEmpty(encodingString))
                        {
                            encodingString = encodingString.Trim().Replace("charset=", "").ToLower();
                            encoding = _encodingMapper.Convert(encodingString);
                        }
                        break;
                    }
                }
            }

            return new Tuple<string, Encoding>(contentType, encoding);
        }
开发者ID:realestate-com-au,项目名称:pact-net,代码行数:27,代码来源:HttpBodyContentMapper.cs

示例10: OnNavigatedToAsync

 /// <summary>
 /// 
 /// </summary>
 /// <param name="parameter">MapPokemonWrapper containing the Pokemon that we're trying to capture</param>
 /// <param name="mode"></param>
 /// <param name="suspensionState"></param>
 /// <returns></returns>
 public override async Task OnNavigatedToAsync(object parameter, NavigationMode mode,
     IDictionary<string, object> suspensionState)
 {
     if (suspensionState.Any())
     {
         // Recovering the state
         CurrentPokemon = (MapPokemonWrapper) suspensionState[nameof(CurrentPokemon)];                
         CurrentEncounter = (EncounterResponse) suspensionState[nameof(CurrentEncounter)];
         CurrentCaptureAward = (CaptureAward) suspensionState[nameof(CurrentCaptureAward)];
         SelectedCaptureItem =  (ItemData) suspensionState[nameof(SelectedCaptureItem)];
     } else if (parameter is bool)
     {                
         // Navigating from game page, so we need to actually load the encounter                
         CurrentPokemon = (MapPokemonWrapper) NavigationHelper.NavigationState[nameof(CurrentPokemon)];
         Busy.SetBusy(true, Utils.Resources.Translation.GetString("LoadingEncounter") + Utils.Resources.Pokemon.GetString(CurrentPokemon.PokemonId.ToString()));
         NavigationHelper.NavigationState.Remove(nameof(CurrentPokemon));
         Logger.Write($"Catching {CurrentPokemon.PokemonId}");                
         CurrentEncounter = await GameClient.EncounterPokemon(CurrentPokemon.EncounterId, CurrentPokemon.SpawnpointId);
         SelectedCaptureItem = ItemsInventory.First(item => item.ItemId == ItemId.ItemPokeBall);
         Busy.SetBusy(false);
         if (CurrentEncounter.Status != EncounterResponse.Types.Status.EncounterSuccess)
         {
             // Encounter failed, probably the Pokemon ran away
             await new MessageDialog(Utils.Resources.Translation.GetString("PokemonRanAway")).ShowAsyncQueue();
             ReturnToGameScreen.Execute();
         }
     }
     await Task.CompletedTask;
 }
开发者ID:Zampeta1,项目名称:PoGo-UWP,代码行数:36,代码来源:CapturePokemonPageViewModel.cs

示例11: Filter

        public virtual bool Filter(IDictionary<string, dynamic> data)
        {
            if (!data.Any(prop => prop.Key == Key && prop.Value.ToString() == Value.Trim('\'')))
                return false;

            return true;
        }
开发者ID:Efimster,项目名称:HelperExtensionsLibrary.EntityFramework,代码行数:7,代码来源:QueryBuilder.cs

示例12: GetParameters

 private string GetParameters(IDictionary<string, object> param)
 {
     var result = param.Any()
                      ? "Params: [" + string.Join(";", param.Keys.Select(key => key + ": " + param[key])) + "]"
                      : "No params";
     return result;
 }
开发者ID:AndrewLeanSSW,项目名称:SSW.Training.MusicStore.Enterprise,代码行数:7,代码来源:LogActionAttribute.cs

示例13: SaveTempData

        protected virtual void SaveTempData(ControllerContext controllerContext, IDictionary<string, object> values)
        {
            if (!values.Any())
            {
                var cookied = new HttpCookie(TempDataCookieKey)
                {
                    Expires = DateTime.Now.AddDays(-30),
                    Path = controllerContext.HttpContext.Request.ApplicationPath,
                    Secure = controllerContext.HttpContext.Request.IsSecureConnection
                };
                _httpContext.Response.Cookies.Add(cookied);
                return;
            }
                
            var cookieValue = SerializeToBase64EncodedString(values);

            var cookie = new HttpCookie(TempDataCookieKey)
            {
                HttpOnly = true,
                Value = cookieValue,
                Path = controllerContext.HttpContext.Request.ApplicationPath,
                Secure = controllerContext.HttpContext.Request.IsSecureConnection
            };

            _httpContext.Response.Cookies.Add(cookie);
        }
开发者ID:eByte23,项目名称:SchoStack,代码行数:26,代码来源:CookieTempDataProvider.cs

示例14: OnNavigatedToAsync

 public override async Task OnNavigatedToAsync(object parameter, NavigationMode mode, IDictionary<string, object> suspensionState)
 {
     if (suspensionState.Any())
     {
         Value = suspensionState[nameof(Value)]?.ToString();
     }
     await Task.CompletedTask;
 }
开发者ID:Rasetech,项目名称:Template10,代码行数:8,代码来源:MainPageViewModel.cs

示例15: StempelPolishStemFilterFactory

 /// <summary>
 /// Creates a new <see cref="StempelPolishStemFilterFactory"/>
 /// </summary>
 public StempelPolishStemFilterFactory(IDictionary<string, string> args)
     : base(args)
 {
     if (args.Any())
     {
         throw new ArgumentException("Unknown parameters: " + args);
     }
 }
开发者ID:ChristopherHaws,项目名称:lucenenet,代码行数:11,代码来源:StempelPolishStemFilterFactory.cs


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