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


C# IDictionary.Add方法代码示例

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


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

示例1: FillDiagnosticHeaders

 private static void FillDiagnosticHeaders(IDictionary<string, object> headers)
 {
     headers.Add("author", "test");
     headers.Add("machine", Environment.MachineName);
     headers.Add("app_name", Assembly.GetExecutingAssembly().FullName);
     headers.Add("app_ver", Assembly.GetExecutingAssembly().GetName().Version);
 }
开发者ID:barissonmez,项目名称:nes-training,代码行数:7,代码来源:EvenstreamTests.cs

示例2: CreateDictionaryForSearch

        public static void CreateDictionaryForSearch(IDictionary<string, object> dict, Expression memberExpression, object expressionValue)
        {
            var visitor = new FindMembers();
            visitor.Visit(memberExpression);

            var members = visitor.Members;

            if (members.Count > 1)
            {
                var temp = new Dictionary<string, object>();
                var member = members.Last();
                var value = expressionValue;
                temp.Add(member.Name, value);

                members.Reverse().Skip(1).Each(m => { temp = new Dictionary<string, object> {{m.Name, temp}}; });

                var topMemberName = members.First().Name;
                dict.Add(topMemberName, temp[topMemberName]);
            }
            else
            {
                var member = members.Single();
                var value = expressionValue;
                dict.Add(member.Name, value);
            }
        }
开发者ID:nieve,项目名称:marten,代码行数:26,代码来源:ContainmentWhereFragment.cs

示例3: set_install_dictionary

 /// <summary>
 ///   Sets install dictionary
 /// </summary>
 private void set_install_dictionary(IDictionary<string, ExternalCommandArgument> args)
 {
     args.Add("_cmd_c_", new ExternalCommandArgument {ArgumentOption = "/c", Required = true});
     args.Add("_gem_", new ExternalCommandArgument {ArgumentOption = "gem", Required = true});
     args.Add("_action_", new ExternalCommandArgument {ArgumentOption = "install", Required = true});
     args.Add("_package_name_", new ExternalCommandArgument
         {
             ArgumentOption = "package name ",
             ArgumentValue = PACKAGE_NAME_TOKEN,
             QuoteValue = false,
             UseValueOnly = true,
             Required = true
         });
     
     args.Add("Force", new ExternalCommandArgument
         {
             ArgumentOption = "-f ",
             QuoteValue = false,
             Required = false
         });
     
     args.Add("Version", new ExternalCommandArgument
         {
             ArgumentOption = "--version ",
             QuoteValue = false,
             Required = false
         });
 }
开发者ID:pkdevboxy,项目名称:choco,代码行数:31,代码来源:RubyGemsService.cs

示例4: GCalculationView

        public GCalculationView()
        {
            InitializeComponent();
            this._lstMonitor = new List<ICalculationMonitor>();
            //_fcName = new TnFeatureClassName();
            _dicSql = new Dictionary<EnumG1ArcGisTnRecType, string>();
            //_dicSql.Add(EnumG1ArcGisTnRecType.Doanduong, string.Format("select {0},{1},{2} from {3} where {4}=N'{5}'", _fcName.FC_DUONG.MA_DUONG, _fcName.FC_DUONG.BAT_DAU, _fcName.FC_DUONG.KET_THUC, "sde.thixa_duong", _fcName.FC_DUONG.TEN_DUONG, v));
            //_dicSql.Add(EnumG1ArcGisTnRecType.Doanduong, );
            //_sql = string.Format("select {0},{1},{2} from {3} where {4}='a'", _fcName.FC_DUONG.MA_DUONG, _fcName.FC_DUONG.BAT_DAU, _fcName.FC_DUONG.KET_THUC, "sde.thixa_duong", _fcName.FC_DUONG.TEN_DUONG);
            //_dicSql.Add(EnumG1ArcGisTnRecType.Doanduong, "");
            //_dicSql.Add(EnumG1ArcGisTnRecType.Duong, string.Format("select distinct {0} from {1}", _fcName.FC_DUONG.TEN_DUONG, "sde.thixa_duong"));
            //_dicSql.Add(EnumG1ArcGisTnRecType.Huyen, "");
            //_dicSql.Add(EnumG1ArcGisTnRecType.Xa, string.Format("select {0},{1} from {2}", _fcName.FC_RANH_XA_POLY.MA_XA, _fcName.FC_RANH_XA_POLY.TEN_XA, "sde.THIXA_XAPOLY"));
            _dicSql.Add(EnumG1ArcGisTnRecType.Doanduong, "");
            _dicSql.Add(EnumG1ArcGisTnRecType.Duong, "");
            _dicSql.Add(EnumG1ArcGisTnRecType.Huyen, "");
            _dicSql.Add(EnumG1ArcGisTnRecType.Xa, "");

            _loader = new Loader(this);
            _loader.Finished += new LoaderFinishedEventHandler(loader_Finished);
            _loaderController = new LoaderController(this, _loader);
            this.btnCloseFrmTinhAll.Click += new EventHandler(btnCloseFrmTinhAll_Click);
            this.cbxDuong.Click += new EventHandler(cbxDuong_Click);
            this.cbxXa.Click += new EventHandler(cbxXa_Click);
            this.cbxDoanDuong.Click += new EventHandler(cbxDoanDuong_Click);
        }
开发者ID:truonghinh,项目名称:TnX,代码行数:26,代码来源:GCalculationView.cs

示例5: GroupModePanel

        public GroupModePanel()
        {
            computers = new List<IComputer>();

            InitializeComponent();

            computerColumn.Renderer = new ComputerCellRenderer();
            differencesColumn.Renderer = new HostDifferenceCellRenderer();

            computerColumn.Text = Properties.Resources.computersTable_computerColumn_Text;
            differencesColumn.Text = Properties.Resources.computersTable_differencesColumn_Text;

            settingPanels = new Dictionary<RadioButton, IActionPanel>();

            settingPanels.Add(systemPartitionProtectRadioButton,
                new SystemPartitionProtectPanel());

            settingPanels.Add(customPartitionProtectRadioButton,
                new CustomPartitionProtectPanel());

            settingPanels.Add(changePaswordRadioButton,
                new ChangePasswordPanel());

            settingPanels.Add(changeLicenseRadioButton,
                new ChangeLicensePanel());

            settingPanels.Add(rebootRemoteComputerRadioButton,
                new RebootRemoteComputerPanel());

            foreach (AbstractActionPanel panel in settingPanels.Values)
            {
                panel.Dock = DockStyle.Fill;
                panel.ActionStatusChanged += GroupModePanel_ActionStatusChanged;
            }
        }
开发者ID:virl,项目名称:yttrium,代码行数:35,代码来源:GroupModePanel.cs

示例6: InitReplaceMap

 private void InitReplaceMap(IArticle article)
 {
     this.replaceMap = new Dictionary<string, string>();
     replaceMap.Add(Placeholder.ArticlePlaceholder.NamePlaceholder, article.Description);
     replaceMap.Add(Placeholder.ArticlePlaceholder.DescriptionPlaceholder,article.Description + " " + article.Description2);
     replaceMap.Add(Placeholder.ArticlePlaceholder.ManufactorPlaceholder, article.Manufactorer);
 }
开发者ID:holzleube,项目名称:ebayTire,代码行数:7,代码来源:PlaceholderReplacer.cs

示例7: CallRestful

 /// <summary>
 /// 发起推送请求到信鸽并获得相应
 /// </summary>
 /// <param name="url">url</param>
 /// <param name="parameters">字段</param>
 /// <returns>返回值json反序列化后的类</returns>
 private Ret CallRestful(String url, IDictionary<string, string> parameters)
 {
     if (parameters == null)
     {
         throw new ArgumentNullException("parameters");
     }
     if (string.IsNullOrEmpty(url))
     {
         throw new ArgumentNullException("url");
     }
     try
     {
         parameters.Add("access_id", accessId);
         parameters.Add("timestamp", ((int)(DateTime.Now - TimeZone.CurrentTimeZone.ToLocalTime(
         new System.DateTime(1970, 1, 1))).TotalSeconds).ToString());
         parameters.Add("valid_time", valid_time.ToString());
         string md5sing = SignUtility.GetSignature(parameters, this.secretKey, url);
         parameters.Add("sign", md5sing);
         var res = HttpWebResponseUtility.CreatePostHttpResponse(url, parameters, null, null, Encoding.UTF8, null);
         var resstr = res.GetResponseStream();
         System.IO.StreamReader sr = new System.IO.StreamReader(resstr);
         var resstring = sr.ReadToEnd();
         return JsonConvert.DeserializeObject<Ret>(resstring);
     }
     catch (Exception e)
     {
         return new Ret { ret_code = -1, err_msg = e.Message };
     }
 }
开发者ID:onedot,项目名称:XinGePushSDK.NET,代码行数:35,代码来源:XingeApp.cs

示例8: MapperRegister

        static void MapperRegister()
        {
            container = new Dictionary<string, IDataMapper>();

            container.Add(typeof(UserMapper).FullName, new UserMapper());
            container.Add(typeof(ProductMapper).FullName, new ProductMapper());
        }
开发者ID:anytao,项目名称:insidenet,代码行数:7,代码来源:Program.cs

示例9: CogsStorage

 static CogsStorage()
 {
     ManagerConfigurations = new Dictionary<CogsSessionManagementStrategy, Func<ICogsSessionManager>>();
     ManagerConfigurations.Add(CogsSessionManagementStrategy.Static, () => new StaticSessionManager());
     ManagerConfigurations.Add(CogsSessionManagementStrategy.Web,
                                () => new WebSessionManager(new HttpContextWrapper(HttpContext.Current)));
 }
开发者ID:bgertonson,项目名称:CogsDB,代码行数:7,代码来源:CogsStorage.cs

示例10: CreateDictionaryForSearch

        public static void CreateDictionaryForSearch(BinaryExpression binary, IDictionary<string, object> dict)
        {
            var visitor = new FindMembers();
            visitor.Visit(binary.Left);

            var members = visitor.Members;

            if (members.Count > 1)
            {
                var temp = new Dictionary<string, object>();
                var member = members.Last();
                var value = MartenExpressionParser.Value(binary.Right);
                temp.Add(member.Name, value);

                members.Reverse().Skip(1).Each(m => { temp = new Dictionary<string, object> {{m.Name, temp}}; });

                var topMemberName = members.First().Name;
                dict.Add(topMemberName, temp[topMemberName]);
            }
            else
            {
                var member = members.Single();
                var value = MartenExpressionParser.Value(binary.Right);
                dict.Add(member.Name, value);
            }

        }
开发者ID:kiliman,项目名称:marten,代码行数:27,代码来源:ContainmentWhereFragment.cs

示例11: Setup

 public void Setup()
 {
     personDictionary = new Dictionary<string, int>();
     personDictionary.Add("Mark", 38);
     personDictionary.Add("Daniela", 38);
     readonlyPersonDictionary = new ReadOnlyDictionary<string, int>(personDictionary);
 }
开发者ID:Binodesk,项目名称:spring-net,代码行数:7,代码来源:ReadOnlyDictionaryTests.cs

示例12: MovieService

 public MovieService()
 {
     movies = new Dictionary<int, Movie>();
     movies.Add(0, new Movie() { ID = 0, Title = "La vita e bella", Director = "Roberto Benigni" });
     movies.Add(1, new Movie() { ID = 1, Title = "Pulp Fiction", Director = "Quentin Tarantino" });
     index = 1;
 }
开发者ID:nsavga,项目名称:spring-net-rest,代码行数:7,代码来源:MovieService.svc.cs

示例13: Perform

        public object Perform(object __p1)
        {
            if (jsEscapes == null)
            {
                lock (this)
                {
                    jsEscapes = new Dictionary<string, string>();
                    jsEscapes.Add("\\", "\\x5C");
                    jsEscapes.Add("\'", "\\x27");
                    jsEscapes.Add("\"", "\\x22");
                    jsEscapes.Add(">", "\\x3E");
                    jsEscapes.Add("<", "\\x3C");
                    jsEscapes.Add("&", "\\x26");
                    jsEscapes.Add("=", "\\x3D");
                    jsEscapes.Add("-", "\\x2D");
                    jsEscapes.Add(";", "\\x3B");
                    for (int i = 0; i < 32; i++)
                    {
                        jsEscapes.Add(new string((char)i, 1), string.Format("\\x{0:X2}", i));
                    }
                }
            }

            string strRetValue = Convert.ToString(__p1);

            foreach (KeyValuePair<string, string> kvPair in jsEscapes)
            {
                strRetValue = strRetValue.Replace(kvPair.Key, kvPair.Value);
            }
            return strRetValue;
        }
开发者ID:IntranetFactory,项目名称:ndjango,代码行数:31,代码来源:EscapeJSFilter.cs

示例14: IISCheck

 public IISCheck()
     : base()
 {
     _names = new Dictionary<string, string>();
     _names.Add("Web Service", "Total Method Requests/sec");
     _names.Add("Servizio Web", "Totale richieste metodo/sec");
 }
开发者ID:rmoorman,项目名称:sd-agent-windows,代码行数:7,代码来源:IISCheck.cs

示例15: EntityNeeds

 public EntityNeeds()
 {
     _needs = new Dictionary<Needs, EntityNeed>();
     _needs.Add(Needs.Food, new EntityNeed(0.0f));
     _needs.Add(Needs.Water, new EntityNeed(0.0f));
     _needs.Add(Needs.Shelter, new EntityNeed(0.0f));
 }
开发者ID:DtheC,项目名称:OpenMaps-Drawing,代码行数:7,代码来源:WayTracer.cs


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