本文整理汇总了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--;
}
}
示例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"]));
}
}
}
示例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;
}
示例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;
}
示例5: Clear
public void Clear(IDictionary dic)
{
if (dic != null)
{
dic.Clear();
}
}
示例6: OnNavigatedTo
public override void OnNavigatedTo(object parameter, NavigationMode mode, IDictionary<string, object> state)
{
if (state.Any())
{
Value = state[nameof(Value)]?.ToString();
state.Clear();
}
}
示例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);
}
}
示例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);
}
示例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;
}
示例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;
}
}
示例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(); }
}
示例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();
}
}
示例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;
}
}
示例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;
}
}
示例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;
}