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


C# IDictionary.Clear方法代码示例

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


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

示例1: Invoke

        public async Task Invoke(IDictionary<string, object> environment)
        {
            int maxRedirects = _maxRedirects;

            while (maxRedirects >= 0)
            {
                await _next(environment);

                var response = new OwinResponse(environment);

                if (response.StatusCode == 302 || response.StatusCode == 301)
                {
                    string url = BuildRedirectUrl(response);

                    // Clear the env so we can make a new request
                    environment.Clear();

                    // Populate the env with new request data
                    RequestBuilder.BuildGet(environment, url);
                }
                else
                {
                    break;
                }

                maxRedirects--;
            }
        }
开发者ID:jango2015,项目名称:OwinHttpClient,代码行数:28,代码来源:RedirectMiddleware.cs

示例2: Install

 public override void Install(IDictionary stateSaver)
 {
     #if DEBUG
     Debugger.Launch();
     #endif
     try
     {
         base.Install(stateSaver);
     }
     catch (Exception)
     {
         UninstaExisted();
         try
         {
             var hash = new Hashtable();
             base.Install(hash);
             stateSaver.Clear();
             foreach (DictionaryEntry item in hash)
             {
                 stateSaver.Add(item.Key, item.Value);
             }
         }
         catch
         {
             Updater.CreateRecord(Path.GetDirectoryName(Context.Parameters["assemblypath"]));
         }
     }
 }
开发者ID:siarheimilkevich,项目名称:VSSync,代码行数:28,代码来源:ProjectInstaller.cs

示例3: 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

示例4: 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

示例5: Clear

 public void Clear(IDictionary dic)
 {
     if (dic != null)
     {
         dic.Clear();
     }
 }      
开发者ID:adisik,项目名称:simple-assembly-explorer,代码行数:7,代码来源:TextFile.cs

示例6: OnNavigatedTo

 public override void OnNavigatedTo(object parameter, NavigationMode mode, IDictionary<string, object> state)
 {
     if (state.Any())
     {
         Value = state[nameof(Value)]?.ToString();
         state.Clear();
     }
 }
开发者ID:Kryptryx,项目名称:Template10,代码行数:8,代码来源:MainPageViewModel.cs

示例7: Fill

		public static void Fill(Condition[] entries, IDictionary<object, PacketSegment> map, Type enumType)
		{
			map.Clear();
			foreach (var entry in entries)
			{
				var obj = Enum.Parse(enumType, entry.Value);
				map.Add(obj, entry.Segment);
			}
		}
开发者ID:pallmall,项目名称:WCell,代码行数:9,代码来源:ConditionMap.cs

示例8: UploadDialog

        public ActionResult UploadDialog(FileUploadViewModel model, IDictionary<string, string> postValues)
        {
            if (postValues!=null && postValues.ContainsKey("NoKeys"))
                postValues.Clear();

            model.PostValuesWithUpload = postValues;

            return PartialView("_MvcFileUpload", model);
        }
开发者ID:jesusgarza,项目名称:MvcFileUploader,代码行数:9,代码来源:MvcFileUploadController.cs

示例9: OnNavigatedToAsync

        public override Task OnNavigatedToAsync(object parameter, NavigationMode mode, IDictionary<string, object> state)
        {
            if (state.ContainsKey(nameof(StartDateValue)))
            {
                StartDateValue = state[nameof(StartDateValue)]?.ToString();
                if (state.ContainsKey(nameof(EndDateValue)))
                {
                    EndDateValue = state[nameof(EndDateValue)]?.ToString();
                }
                state.Clear();
            }
            else
            {
                //Value = parameter?.ToString();
                List<Object> paras = parameter as List<Object>;
                Product = paras[0].ToString();

                StartDateValue = Convert.ToDateTime(paras[1]).ToString("MM/dd/yyyy");
                EndDateValue = Convert.ToDateTime(paras[2]).ToString("MM/dd/yyyy");

                DateRangeInfo = string.Format("Showing data from {0} - {1}", StartDateValue, EndDateValue);
            }
            var task = new Task(new Action(async () =>
            {
                ShowBusy();
                try
                {
                    HttpClientHandler handler = new HttpClientHandler();
                    handler.UseDefaultCredentials = true;
                    using (var client = new HttpClient(handler))
                    {
                        //Choose API version
                        client.DefaultRequestHeaders.Add("X-Version", APIVersion);
                        var url = string.Format(APIBase, "mpi", Product, StartDateValue, EndDateValue, false);
                        var response = await client.GetStringAsync(url);
                        // Parse JSON response.
                        var data = JsonConvert.DeserializeObject<ObservableCollection<AgentMPIModel>>(response);
                        foreach (var item in data)
                        {
                            AgentMPIData.Add(new AgentMPIModel() { Alias = item.Alias, Labor = item.Labor, SDReplied = item.SDReplied, ReplyMPI = item.ReplyMPI });
                        }
                    }
                }
                catch (Exception ex)
                {
                    Debug.WriteLine(ex.Message);
                }
                await Task.Delay(500);
                HideBusy();

                //if (!string.IsNullOrEmpty(Product)) Shell.SetCurrentProduct(Product);
            }));
            task.RunSynchronously();
            //return base.OnNavigatedToAsync(parameter, mode, state);
            return Task.CompletedTask;
        }
开发者ID:Myfreedom614,项目名称:SOPerformanceTool,代码行数:56,代码来源:AgentMPIViewModel.cs

示例10: Deserialize

 public static void Deserialize(TextReader reader, IDictionary dictionary)
 {
     dictionary.Clear();
       XmlSerializer serializer = new XmlSerializer(typeof(List<Entry>));
       List<Entry> list = (List<Entry>)serializer.Deserialize(reader);
       foreach (Entry entry in list)
       {
     dictionary[entry.Key] = entry.Value;
       }
 }
开发者ID:hirec,项目名称:SmartHomeV2,代码行数:10,代码来源:NetflixAuth.cs

示例11: OnNavigatedTo

 public override void OnNavigatedTo(string parameter, NavigationMode mode, IDictionary<string, object> state)
 {
     try
     {
         FirstName = state["FirstName"]?.ToString();
         LastName = state["LastName"]?.ToString();
         Email = state["Email"]?.ToString();
     }
     finally { state.Clear(); }
 }
开发者ID:MuffPotter,项目名称:201505-MVA,代码行数:10,代码来源:DetailsPageViewModel.cs

示例12: OnNavigatedTo

 public override void OnNavigatedTo(object parameter, NavigationMode mode, IDictionary<string, object> state)
 {
     if (state.Any())
     {
         // use cache value(s)
         if (state.ContainsKey(nameof(Value))) Value = state[nameof(Value)]?.ToString();
         // clear any cache
         state.Clear();
     }
 }
开发者ID:timothius2005,项目名称:Template10,代码行数:10,代码来源:MainPageViewModel.cs

示例13: UpdateListOfInheritedProcesses

        /// <summary>
        /// Retrieves list of inherited processes, fills map and add items to DropDown button with inherited items.
        /// </summary>
        /// <param name="processName">
        /// Process name.
        /// </param>
        /// <param name="toolbarItem">
        /// Toolbar button item for "Add" command.
        /// </param>
        /// <param name="processesMap">
        /// Processes map.
        /// </param>
        /// <param name="addItemCommand">
        /// Command for "Add item".
        /// </param>
        public async void UpdateListOfInheritedProcesses(string processName, DropDownToolbarItemMod toolbarItem, IDictionary<string, string> processesMap, ActionCommand<object> addItemCommand)
        {
            toolbarItem.Items.Clear();
            toolbarItem.IsVisible = false;
            processesMap.Clear();

            if (string.IsNullOrWhiteSpace(processName))
            {
                return;
            }

            if (!addItemCommand.CanExecute(null))
            {
                return;
            }

            FindInheritedProcessRetriever res;

            try
            {
                res = await FindInheritedProcessRetriever.GetInheritedProcessesAsync(processName);
            }
            catch (Exception ex)
            {
                Logger.Log(LogSeverity.Error, GetType().FullName, ex);

                throw;
            }

            if (res == null)
            {
                return;
            }

            toolbarItem.Items.Clear();
            toolbarItem.IsVisible = false;
            processesMap.Clear();

            foreach (var baseProcess in res.InheritedProcessesList)
            {
                var editType = TheDynamicTypeManager.Value.GetEditableRootType(baseProcess.ProcessSystemName);
                if (editType == null || !BusinessRules.HasPermission(AuthorizationActions.CreateObject, editType))
                {
                    continue;
                }

                processesMap.Add(baseProcess.ProcessName, baseProcess.ProcessSystemName);
                toolbarItem.Items.Add(new ToolbarItem { Caption = baseProcess.ProcessName, Command = addItemCommand, ContentTemplate = ContentTemplates.iconNewVersionTemplate });
            }

            if (toolbarItem.Items.Count > 1)
            {
                toolbarItem.IsVisible = true;
            }
        }
开发者ID:mparsin,项目名称:Elements,代码行数:70,代码来源:InheritanceHelper.cs

示例14: Pop

        public ICollection<dynamic> Pop()
        {
            lock (_lock)
            {
                Messages = Messages ?? new ConcurrentDictionary<string, object>();

                var temp = new ConcurrentDictionary<string, dynamic>(Messages);
                Messages.Clear();
                return temp.Values;
            }
        }
开发者ID:WillCode4Cash,项目名称:MVCFlash,代码行数:11,代码来源:SessionFlashMessageService.cs

示例15: OnNavigatedToAsync

 public override Task OnNavigatedToAsync(object parameter, NavigationMode mode, IDictionary<string, object> state)
 {
     if (state.Any())
     {
         //Value = state[nameof(Value)]?.ToString();
         StartDateValue = Convert.ToDateTime(state[nameof(StartDateValue)]);
         EndDateValue = Convert.ToDateTime(state[nameof(EndDateValue)]);
         state.Clear();
     }
     return Task.CompletedTask;
 }
开发者ID:dream-365,项目名称:SOPerformanceTool,代码行数:11,代码来源:MainPageViewModel.cs


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