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


C# IReadOnlyDictionary.ContainsKey方法代码示例

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


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

示例1: ProcessSettings

        private static void ProcessSettings(Service service, IReadOnlyDictionary<string, string> settings)
        {
            if (settings.ContainsKey("BasePath"))
                service.BasePath = settings["BasePath"];
            if (settings.ContainsKey("Host"))
                service.Host = settings["Host"];

            if (settings.Keys.Any(k => k.StartsWith("Info")))
                service.Info = new Info();
            if (settings.ContainsKey("InfoDescription"))
                service.Info.Description = settings["InfoDescription"];
            if (settings.ContainsKey("InfoVersion"))
                service.Info.Version = settings["InfoVersion"];
            if (settings.ContainsKey("InfoTermsOfService"))
                service.Info.TermsOfService = settings["InfoTermsOfService"];
            if (settings.ContainsKey("InfoTitle"))
                service.Info.Title = settings["InfoTitle"];

            if (settings.Keys.Any(k => k.StartsWith("InfoContact")))
                service.Info.Contact = new InfoContact();
            if (settings.ContainsKey("InfoContactName"))
                service.Info.Contact.Name = settings["InfoContactName"];
            if (settings.ContainsKey("InfoContactUrl"))
                service.Info.Contact.Url = settings["InfoContactUrl"];
            if (settings.ContainsKey("InfoContactEmail"))
                service.Info.Contact.Email = settings["InfoContactEmail"];

            if (settings.Keys.Any(k => k.StartsWith("InfoLicense")))
                service.Info.License = new InfoLicense();
            if (settings.ContainsKey("InfoLicenseUrl"))
                service.Info.License.Url = settings["InfoLicenseUrl"];
            if (settings.ContainsKey("InfoLicenseName"))
                service.Info.License.Name = settings["InfoLicenseName"];
            
        }
开发者ID:Robin--,项目名称:swaggerwcf,代码行数:35,代码来源:ServiceBuilder.cs

示例2: CheckProperyType

        public static bool CheckProperyType(IReadOnlyDictionary<string, string> data, KeyValuePair<string, string> param)
        {
            var result = true;

            switch (param.Value)
            {
                case "Int32":
                    int number;
                    if (data.ContainsKey(param.Key))
                        result = int.TryParse(data[param.Key], out number);
                    break;
                case "Guid":
                    Guid guid;
                    if (data.ContainsKey(param.Key))
                        result = Guid.TryParse(data[param.Key], out guid);
                    break;
                case "DateTime":
                    DateTime dateTime;
                    if (data.ContainsKey(param.Key))
                        result = DateTime.TryParse(data[param.Key], out dateTime);
                    break;
            }

            return result;
        }
开发者ID:v-lukyanenko,项目名称:Crate.DataStorage,代码行数:25,代码来源:Tools.cs

示例3: GetHandler

        public IChallengeHandler GetHandler(Challenge c, IReadOnlyDictionary<string, object> initParams)
        {
            var h = new ManualChallengeHandler();

            // Start off with the current (default) settings
            var p = h.WriteOutPath;
            var a = h.Append;
            var o = h.Overwrite;

            if (initParams?.Count > 0)
            {
                // See which ones are overridden
                if (initParams.ContainsKey(WRITE_OUT_PATH.Name))
                    p = (string) initParams[WRITE_OUT_PATH.Name];
                if (initParams.ContainsKey(APPEND.Name))
                    a = (bool) initParams[APPEND.Name];
                if (initParams.ContainsKey(OVERWRITE.Name))
                    o = (bool) initParams[OVERWRITE.Name];

                // Apply any changes
                h.SetOut(p, a, o);
            }

            return h;
        }
开发者ID:bseddon,项目名称:ACMESharp,代码行数:25,代码来源:ManualChallengeHandlerProvider.cs

示例4: create

 public void create(IReadOnlyList<string> toolbarElements, IReadOnlyDictionary<string, string> toolBarProperties, IMethodResult oResult)
 {
     MainPage mp = getMainPage();
     if (mp != null)
     {
         mp.toolbarRemoveAllButtons();
         string bgCr = "";
         string mask = "";
         if (toolBarProperties.ContainsKey("backgroundColor"))
             bgCr = toolBarProperties["backgroundColor"];
         if (toolBarProperties.ContainsKey("maskColor"))
             mask = toolBarProperties["maskColor"];
         mp.setToolbarStyle(false, bgCr, mask);
         for (int i = 0; i < toolbarElements.Count; ++i)
         {
             string tb = toolbarElements[i];
             CJSONEntryProxy oEntry = new CJSONEntryProxy(tb);
             string label = null;
             string action = null;
             string icon = null;
             if (oEntry.hasName("label"))
                 label = oEntry.getString("label");
             if (oEntry.hasName("action"))
                 action = oEntry.getString("action");
             if (oEntry.hasName("icon"))
                 icon = oEntry.getString("icon");
             CRhoRuntime.getInstance().logEvent("addToolbarButton: Label: '" + (label==null?"":label) + "';Action: '" + (action==null?"":action) + "'");
             if ((action != null) && !action.Equals("separator", StringComparison.InvariantCultureIgnoreCase))
             {
                 if ((icon != null) && (icon.Length > 0))
                 {
                     icon = "apps"+icon;
                     icon = CRhoRuntime.getInstance().getRootPath(icon);
                 }
                 else
                 {
                     if (action.Equals("options", StringComparison.InvariantCultureIgnoreCase))
                         icon = "res/options_btn.png";
                     else if (action.Equals("home", StringComparison.InvariantCultureIgnoreCase))
                         icon = "res/home_btn.png";
                     else if (action.Equals("refresh", StringComparison.InvariantCultureIgnoreCase))
                         icon = "res/refresh_btn.png";
                     else if (action.Equals("back", StringComparison.InvariantCultureIgnoreCase))
                         icon = "res/back_btn.png";
                     else if (action.Equals("forward", StringComparison.InvariantCultureIgnoreCase))
                         icon = "res/forward_btn.png";
                     if (icon != null)
                         icon = CRhoRuntime.getInstance().getRERuntimePath("lib/" + icon);
                 }
                 mp.toolbarAddAction(icon, label, action);
             }
         }
         mp.toolbarShow();
     }
 }
开发者ID:hanazuki,项目名称:rhodes,代码行数:55,代码来源:NativeToolbar_impl.cs

示例5: ParseText

 public static Number ParseText(string text, IReadOnlyDictionary<string, Variable> variables)
 {
     var postFix = Infix.ToPostfix(text);
     var stack = new Stack<Number>();
     foreach (var val in individualElements(postFix))
     {
         if (Operators.ContainsKey(val))
         {
             var op = createOperator(val, stack);
             stack.Push(op);
         }
         else if (variables.ContainsKey(val))
         {
             var variable = getVariable(variables, val);
             stack.Push(variable);
         }
         else
         {
             var nbr = createNbr(val);
             if(nbr != null)
                 stack.Push(nbr);
             else
                 throw new NotSupportedException("The string is not recogniezed as a value");
         }
     }
     return stack.Pop();
 }
开发者ID:JohannaMoose,项目名称:Lynx,代码行数:27,代码来源:TextParser.cs

示例6: GetValues

 public static object[] GetValues(Object t, IReadOnlyDictionary<string, object> specifiedValues, FieldOrProperty[] props, ConstructorInfo ctor)
 {
     var ctorParams = ctor.GetParameters();
     var values = new object[ctorParams.Length];
     for (int i = 0; i < values.Length; i++)
     {
         var param = ctorParams[i];
         if (specifiedValues.ContainsKey(param.Name))
         {
             values[i] = specifiedValues[param.Name].Coerce(param.ParameterType);
             continue;
         }
         var p = props.SingleOrDefault(prop => prop.Name.Equals(param.Name,
             StringComparison.InvariantCultureIgnoreCase));
         if (p != null)
         {
             values[i] = p.GetValue(t).Coerce(param.ParameterType);
         }
         else
         {
             throw new MissingValueException(param.Name);
         }
     }
     return values;
 }
开发者ID:wastaz,项目名称:with,代码行数:25,代码来源:GetConstructorParameterValues.cs

示例7: VariablesWindow

		public VariablesWindow(IReadOnlyDictionary<string, string> Variables)
		{
			InitializeComponent();

			ListViewGroup CurrentProjectGroup = new ListViewGroup("Current Project");
			MacrosList.Groups.Add(CurrentProjectGroup);

			ListViewGroup EnvironmentGroup = new ListViewGroup("Environment");
			MacrosList.Groups.Add(EnvironmentGroup);

			foreach(KeyValuePair<string, string> Pair in Variables)
			{
				ListViewItem Item = new ListViewItem(String.Format("$({0})", Pair.Key));
				Item.SubItems.Add(Pair.Value);
				Item.Group = CurrentProjectGroup;
				MacrosList.Items.Add(Item);
			}

			foreach(DictionaryEntry Entry in Environment.GetEnvironmentVariables())
			{
				string Key = Entry.Key.ToString();
				if(!Variables.ContainsKey(Key))
				{
					ListViewItem Item = new ListViewItem(String.Format("$({0})", Key));
					Item.SubItems.Add(Entry.Value.ToString());
					Item.Group = EnvironmentGroup;
					MacrosList.Items.Add(Item);
				}
			}
		}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:30,代码来源:VariablesWindow.cs

示例8: Filter

 public IEnumerable<string> Filter(IEnumerable<string> words,
     IReadOnlyDictionary<string, WordGrammarInfo> grammarInfo)
 {
     return words
         .Where(word => grammarInfo.ContainsKey(word) &&
                        allowedPartsOfSpeech.Contains(grammarInfo[word].PartOfSpeech));
 }
开发者ID:borzunov,项目名称:kontur-school-03-design-hw,代码行数:7,代码来源:PartOfSpeechFilter.cs

示例9: GetCellType

 private static CellType GetCellType(MapCell cell, IReadOnlyDictionary<int, List<MapCellData>> cellData)
 {
     if (!cellData.ContainsKey(cell.MapInfoId)) return CellType.None;
     var datas = cellData[cell.MapInfoId];
     var data = datas.SingleOrDefault(x => cell.IdInEachMapInfo == x.No);
     if (data == default(MapCellData)) return CellType.None;
     return data.EventId.ToCellType();
 }
开发者ID:nanakayashiro,项目名称:BattleInfoPlugin,代码行数:8,代码来源:MapData.cs

示例10: GetDesserts

 public static string GetDesserts(IReadOnlyDictionary<int, Dictionary<string, int>> order)
 {
     if (order.ContainsKey((int)DishType.DishTypeEnum.Dessert))
     {
         return order[(int)DishType.DishTypeEnum.Dessert].FirstOrDefault().Key + (order[(int)DishType.DishTypeEnum.Dessert] == order.Last().Value ? "" : ", ");
     }
     return "";
 }
开发者ID:Marcus74,项目名称:OdeToFoodConsoleApp,代码行数:8,代码来源:Dessert.cs

示例11: GetCellType

 public static CellType GetCellType(this MapCell cell, IReadOnlyDictionary<MapCell, CellType> knownTypes)
 {
     var result = CellType.None;
     if (knownTypes.ContainsKey(cell)) result = result | knownTypes[cell];
     var cellMaster = Repositories.Master.Current.MapCells[cell.Id];
     result = result | cellMaster.ColorNo.ToCellType();
     return result;
 }
开发者ID:nanakayashiro,项目名称:BattleInfoPlugin,代码行数:8,代码来源:CellType.cs

示例12: create

        public void create(IReadOnlyList<string> tabElements, IReadOnlyDictionary<string, string> tabBarProperties, IMethodResult oResult)
        {
            MainPage mp = getMainPage();
            if (mp != null)
            {
                mp.tabbarHide();
                mp.toolbarRemoveAllButtons();
                string tab_background_color = null;
                if (tabBarProperties.ContainsKey("backgroundColor"))
                    tab_background_color = tabBarProperties["backgroundColor"];
                for (int i = 0; i < tabElements.Count; ++i)
                {
                    string tb = tabElements[i];
                    CJSONEntryProxy oEntry = new CJSONEntryProxy(tb);

                    string label = null;
                    string action = null;
                    string icon = null;
                    string reload = null;
    	            string selected_color = null;
                    string disabled = null;
                    string background_color = null;
                    string use_current_view_for_tab = null;

                    if (oEntry.hasName("label"))
                        label = oEntry.getString("label");
                    if (oEntry.hasName("action"))
                        action = oEntry.getString("action");
                    if (oEntry.hasName("icon"))
                        icon = oEntry.getString("icon");
                    if (oEntry.hasName("reload"))
                        reload = oEntry.getString("reload");
                    if (oEntry.hasName("selectedColor"))
                        selected_color = oEntry.getString("selectedColor");
                    if (oEntry.hasName("disabled"))
                        disabled = oEntry.getString("disabled");
                    if (oEntry.hasName("backgroundColor"))
                        background_color = oEntry.getString("backgroundColor");
                    if (oEntry.hasName("useCurrentViewForTab"))
                        use_current_view_for_tab = oEntry.getString("useCurrentViewForTab");

                    if ((icon != null) && (icon.Length > 0))
                        icon = CRhoRuntime.getInstance().getAppRootPath(icon);

                    CRhoRuntime.getInstance().logEvent("AddTab: " + (label==null?"(null)":label) + "; " +
                        (icon==null?"(null)":icon) + "; " + (action==null?"(null)":action) + "; " +
                        charToBool(disabled) + "; " + (background_color==null?"(null)":background_color) + "; " +
                        (selected_color==null?"(null)":selected_color) + "; " +
                        (tab_background_color==null?"(null)":tab_background_color) + "; " +
                        charToBool(reload) + "; " + charToBool(use_current_view_for_tab));
                    mp.tabbarAddTab(label, icon, action, charToBool(disabled),
                        background_color, selected_color, tab_background_color,
                        charToBool(reload), charToBool(use_current_view_for_tab), oResult.hasCallback(), oResult);                    
                }
                mp.tabbarSwitch(0);
                mp.tabbarShow();
            }
        }
开发者ID:javiermolina1234,项目名称:rhodes,代码行数:58,代码来源:NativeTabbar_impl.cs

示例13: GetDrinks

 public static string GetDrinks(IReadOnlyDictionary<int, Dictionary<string, int>> order)
 {
     if (!order.ContainsKey((int)DishType.DishTypeEnum.Drink)) return "";
     var key = order[(int)DishType.DishTypeEnum.Drink].FirstOrDefault().Key;
     var keyValue = order[(int)DishType.DishTypeEnum.Drink].FirstOrDefault().Value;
     return order[(int)DishType.DishTypeEnum.Drink].FirstOrDefault().Key +
         (key.Equals("coffee") && keyValue > 1 ? "(x" + order[(int)DishType.DishTypeEnum.Drink].FirstOrDefault().Value + ")" : "")
         + (order[(int)DishType.DishTypeEnum.Drink] == order.Last().Value ? "" : ", ");
 }
开发者ID:Marcus74,项目名称:OdeToFoodConsoleApp,代码行数:9,代码来源:Drink.cs

示例14: ValidateParameters

 private void ValidateParameters(IReadOnlyDictionary<string, object> parameters)
 {
     foreach (ParameterDetail detail in Params.Where(x => x.IsRequired))
     {
         if (!parameters.ContainsKey(detail.Name))
         {
             throw new KeyNotFoundException($"Missing required parameter [{detail.Name}]");
         }
     }
 }
开发者ID:ebekker,项目名称:ACMESharp,代码行数:10,代码来源:CloudFlareChallengeHandlerProvider.cs

示例15: GetSenderTapeTariff

		public static decimal? GetSenderTapeTariff(
			IReadOnlyDictionary<long, decimal> tariffs,
			long? senderId)
		{
			// for senders should not display custom cost for tape

			return tariffs != null && senderId.HasValue && tariffs.ContainsKey(senderId.Value)
				? tariffs[senderId.Value]
				: (decimal?)null;
		}
开发者ID:UHgEHEP,项目名称:test,代码行数:10,代码来源:CalculationHelper.cs


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