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


C# ConcurrentDictionary.Add方法代码示例

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


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

示例1: TestDuplicateAdd

        public void TestDuplicateAdd()
        {
            var dict = new ConcurrentDictionary<int, string>();

            dict.Add(3, string.Empty);
            dict.Add(3, string.Empty);
        }
开发者ID:hanson-huang,项目名称:Encore,代码行数:7,代码来源:ConcurrentDictionaryExtensionsTest.cs

示例2: TestLockFreeDictionary

        public void TestLockFreeDictionary()
        {
            IDictionary<int, Guid> dict = new ConcurrentDictionary<int, Guid>();

            KeyValuePair<int, Guid> test = new KeyValuePair<int, Guid>(-64, Guid.NewGuid());

            dict.Add(42, Guid.NewGuid());
            dict.Add(22, Guid.NewGuid());
            dict.Add(test);
            dict.Add(55, Guid.NewGuid());

            Assert.IsTrue(dict.ContainsKey(-64));
            Assert.IsTrue(dict.Contains(test));
            Assert.IsFalse(dict.Contains(new KeyValuePair<int, Guid>(-64, new Guid())));

            dict[-64] = Guid.NewGuid();
            Assert.IsFalse(dict.Contains(test));

            Guid newID = Guid.NewGuid();
            dict[12] = newID;
            Guid id = dict[12];

            Assert.IsTrue(newID == id);

            Assert.IsTrue(dict.Count == 5);

            dict.Remove(-64);
            Assert.IsTrue(dict.Count == 4);

        }
开发者ID:mbmccormick,项目名称:Ximura,代码行数:30,代码来源:Test_Collections_Dictionary.cs

示例3: DefaultIdComponentConverterContainer

 public DefaultIdComponentConverterContainer()
 {
     ValueConverters = new ConcurrentDictionary<Type, IIdComponentConverter>();
     ValueConverters.Add(typeof(DateTimeIdComponentConverter), new DateTimeIdComponentConverter());
     ValueConverters.Add(typeof (GuidIdComponentConverter), new GuidIdComponentConverter());
     ValueConverters.Add(typeof(EnumIdComponentConverter), new EnumIdComponentConverter());
     ValueConverters.Add(typeof(IntIdComponentConverter), new IntIdComponentConverter());
     ValueConverters.Add(typeof(LongIdComponentConverter), new LongIdComponentConverter());
     ValueConverters.Add(typeof (StringIdComponentConverter), new StringIdComponentConverter());
 }
开发者ID:TonightWe,项目名称:TW.UbiquitousId,代码行数:10,代码来源:DefaultIdComponentConverterContainer.cs

示例4: GetData

        /// <summary>
        /// IP Details From IP Address
        /// </summary>
        /// <param name="ip">
        /// The ip.
        /// </param>
        /// <param name="format">
        /// The format.
        /// </param>
        /// <param name="callback">
        /// The callback.
        /// </param>
        /// <param name="culture">
        /// The culture.
        /// </param>
        /// <param name="browser">
        /// The browser.
        /// </param>
        /// <param name="os">
        /// The os.
        /// </param>
        /// <returns>
        /// IPLocator Class
        /// </returns>
        public IDictionary<string, string> GetData([CanBeNull] string ip, [CanBeNull] string format, bool callback, string culture, string browser, string os)
        {
            CodeContracts.VerifyNotNull(ip, "ip");

            IDictionary<string, string> res = new ConcurrentDictionary<string, string>();

            if (YafContext.Current.Get<YafBoardSettings>().IPLocatorResultsMapping.IsNotSet() ||
                YafContext.Current.Get<YafBoardSettings>().IPLocatorUrlPath.IsNotSet())
            {
                return res;
            }

            if (!YafContext.Current.Get<YafBoardSettings>().EnableIPInfoService)
            {
                return res;
            }

            try
            {
                string path = YafContext.Current.Get<YafBoardSettings>().IPLocatorUrlPath.FormatWith(Utils.Helpers.IPHelper.GetIp4Address(ip));
                var client = new WebClient();
                string[] result = client.DownloadString(path).Split(';');
                string[] sray = YafContext.Current.Get<YafBoardSettings>().IPLocatorResultsMapping.Trim().Split(',');
                if (result.Length > 0 && result.Length == sray.Length)
                {
                    int i = 0;
                    foreach (string str in result)
                    {
                        res.Add(sray[i].Trim(), str);
                        i++;
                    }
                }
            }
            catch
            {
                return res;
            }

            return res;
        }
开发者ID:geoDarkAngel,项目名称:YAFNET,代码行数:64,代码来源:IPLocator.cs

示例5: Add_KeyValuePairThrowsNotImplementedException

        public void Add_KeyValuePairThrowsNotImplementedException()
        {
            // Arrange
            ConcurrentDictionary<int, int> dictionary = new ConcurrentDictionary<int, int>();

            // Act/Assert
            Assert.Throws<NotImplementedException>(() => dictionary.Add(new KeyValuePair<int, int>(0, 0)));
        }
开发者ID:huangw-t,项目名称:aspnetwebstack,代码行数:8,代码来源:ConcurrentDictionaryTests.cs

示例6: Repository

        /// <summary>
        /// Initializes a new instance of the <see cref="Artefacts.Service.ArtefactRepository"/> class.
        /// </summary>
        public Repository()
        {
            Context = this;
            _randomGenerator = new Random(DateTime.Now.Second);
            _artefactCache = new Dictionary<int, Artefact>();
            _countCache = new Dictionary<object, int>();
            //_queryResultCache = new Dictionary<object, QueryResult<Artefact>>();
            _queryExecuteQueue = new ConcurrentQueue<object>();
            _nhQueryProvider = new DefaultQueryProvider(Session.GetSessionImplementation());
            _binaryFormatter = new BinaryFormatter();

            Configuration = new ArtefactServiceConfiguration();
            QueryVisitor = new ServerQueryVisitor(this);
            QueryFormatterVisitor = new ToStringVisitor();
            QueryCache = new Dictionary<object, IQueryable>();
            Artefacts = Session.Query<Artefact>();
            Queryables = new ConcurrentDictionary<Type, IQueryable>();
            Queryables.Add(typeof(Artefact), Artefacts);
        }
开发者ID:jbowwww,项目名称:ArtefactService,代码行数:22,代码来源:Repository.cs

示例7: Initialize

        /// <summary>
        /// Initializes the data feed for the specified job and algorithm
        /// </summary>
        public void Initialize(IAlgorithm algorithm, AlgorithmNodePacket job, IResultHandler resultHandler, IMapFileProvider mapFileProvider, IFactorFileProvider factorFileProvider)
        {
            if (!(job is LiveNodePacket))
            {
                throw new ArgumentException("The LiveTradingDataFeed requires a LiveNodePacket.");
            }

            _cancellationTokenSource = new CancellationTokenSource();

            _algorithm = algorithm;
            _job = (LiveNodePacket) job;
            _resultHandler = resultHandler;
            _timeProvider = GetTimeProvider();
            _dataQueueHandler = GetDataQueueHandler();

            _frontierTimeProvider = new ManualTimeProvider(_timeProvider.GetUtcNow());
            _customExchange = new BaseDataExchange("CustomDataExchange") {SleepInterval = 10};
            // sleep is controlled on this exchange via the GetNextTicksEnumerator
            _exchange = new BaseDataExchange("DataQueueExchange"){SleepInterval = 0};
            _exchange.AddEnumerator(DataQueueHandlerSymbol, GetNextTicksEnumerator());
            _subscriptions = new ConcurrentDictionary<Symbol, List<Subscription>>();

            _bridge = new BusyBlockingCollection<TimeSlice>();
            _universeSelection = new UniverseSelection(this, algorithm, job.Controls);

            // run the exchanges
            Task.Run(() => _exchange.Start(_cancellationTokenSource.Token));
            Task.Run(() => _customExchange.Start(_cancellationTokenSource.Token));

            // this value will be modified via calls to AddSubscription/RemoveSubscription
            var ffres = Time.OneMinute;
            _fillForwardResolution = Ref.Create(() => ffres, v => ffres = v);

            // wire ourselves up to receive notifications when universes are added/removed
            var start = _timeProvider.GetUtcNow();
            algorithm.UniverseManager.CollectionChanged += (sender, args) =>
            {
                switch (args.Action)
                {
                    case NotifyCollectionChangedAction.Add:
                        foreach (var universe in args.NewItems.OfType<Universe>())
                        {
                            _subscriptions.Add(universe.Configuration.Symbol, CreateUniverseSubscription(universe, start, Time.EndOfTime));
                            UpdateFillForwardResolution();
                        }
                        break;

                    case NotifyCollectionChangedAction.Remove:
                        foreach (var universe in args.OldItems.OfType<Universe>())
                        {
                            RemoveSubscription(universe.Configuration.Symbol);
                        }
                        break;

                    default:
                        throw new NotImplementedException("The specified action is not implemented: " + args.Action);
                }
            };
        }
开发者ID:kaffeebrauer,项目名称:Lean,代码行数:62,代码来源:LiveTradingDataFeed.cs

示例8: HtmlEntity

        /// <summary>
        /// Initializes static members of the <see cref="HtmlEntity"/> class.
        /// </summary>
        static HtmlEntity()
        {
            EntityValue = new ConcurrentDictionary<string, int>();
            EntityName = new ConcurrentDictionary<int, string>();

            EntityValue.Add("nbsp", 160); // no-break space = non-breaking space, U+00A0 ISOnum
            EntityName.Add(160, "nbsp");
            EntityValue.Add("iexcl", 161); // inverted exclamation mark, U+00A1 ISOnum
            EntityName.Add(161, "iexcl");
            EntityValue.Add("cent", 162); // cent sign, U+00A2 ISOnum
            EntityName.Add(162, "cent");
            EntityValue.Add("pound", 163); // pound sign, U+00A3 ISOnum
            EntityName.Add(163, "pound");
            EntityValue.Add("curren", 164); // currency sign, U+00A4 ISOnum
            EntityName.Add(164, "curren");
            EntityValue.Add("yen", 165); // yen sign = yuan sign, U+00A5 ISOnum
            EntityName.Add(165, "yen");
            EntityValue.Add("brvbar", 166); // broken bar = broken vertical bar, U+00A6 ISOnum
            EntityName.Add(166, "brvbar");
            EntityValue.Add("sect", 167); // section sign, U+00A7 ISOnum
            EntityName.Add(167, "sect");
            EntityValue.Add("uml", 168); // diaeresis = spacing diaeresis, U+00A8 ISOdia
            EntityName.Add(168, "uml");
            EntityValue.Add("copy", 169); // copyright sign, U+00A9 ISOnum
            EntityName.Add(169, "copy");
            EntityValue.Add("ordf", 170); // feminine ordinal indicator, U+00AA ISOnum
            EntityName.Add(170, "ordf");
            EntityValue.Add("laquo", 171);

            // left-pointing double angle quotation mark = left pointing guillemet, U+00AB ISOnum
            EntityName.Add(171, "laquo");
            EntityValue.Add("not", 172); // not sign, U+00AC ISOnum
            EntityName.Add(172, "not");
            EntityValue.Add("shy", 173); // soft hyphen = discretionary hyphen, U+00AD ISOnum
            EntityName.Add(173, "shy");
            EntityValue.Add("reg", 174); // registered sign = registered trade mark sign, U+00AE ISOnum
            EntityName.Add(174, "reg");
            EntityValue.Add("macr", 175); // macron = spacing macron = overline = APL overbar, U+00AF ISOdia
            EntityName.Add(175, "macr");
            EntityValue.Add("deg", 176); // degree sign, U+00B0 ISOnum
            EntityName.Add(176, "deg");
            EntityValue.Add("plusmn", 177); // plus-minus sign = plus-or-minus sign, U+00B1 ISOnum
            EntityName.Add(177, "plusmn");
            EntityValue.Add("sup2", 178); // superscript two = superscript digit two = squared, U+00B2 ISOnum
            EntityName.Add(178, "sup2");
            EntityValue.Add("sup3", 179); // superscript three = superscript digit three = cubed, U+00B3 ISOnum
            EntityName.Add(179, "sup3");
            EntityValue.Add("acute", 180); // acute accent = spacing acute, U+00B4 ISOdia
            EntityName.Add(180, "acute");
            EntityValue.Add("micro", 181); // micro sign, U+00B5 ISOnum
            EntityName.Add(181, "micro");
            EntityValue.Add("para", 182); // pilcrow sign = paragraph sign, U+00B6 ISOnum
            EntityName.Add(182, "para");
            EntityValue.Add("middot", 183); // middle dot = Georgian comma = Greek middle dot, U+00B7 ISOnum
            EntityName.Add(183, "middot");
            EntityValue.Add("cedil", 184); // cedilla = spacing cedilla, U+00B8 ISOdia
            EntityName.Add(184, "cedil");
            EntityValue.Add("sup1", 185); // superscript one = superscript digit one, U+00B9 ISOnum
            EntityName.Add(185, "sup1");
            EntityValue.Add("ordm", 186); // masculine ordinal indicator, U+00BA ISOnum
            EntityName.Add(186, "ordm");
            EntityValue.Add("raquo", 187);

            // right-pointing double angle quotation mark = right pointing guillemet, U+00BB ISOnum
            EntityName.Add(187, "raquo");
            EntityValue.Add("frac14", 188); // vulgar fraction one quarter = fraction one quarter, U+00BC ISOnum
            EntityName.Add(188, "frac14");
            EntityValue.Add("frac12", 189); // vulgar fraction one half = fraction one half, U+00BD ISOnum
            EntityName.Add(189, "frac12");
            EntityValue.Add("frac34", 190); // vulgar fraction three quarters = fraction three quarters, U+00BE ISOnum
            EntityName.Add(190, "frac34");
            EntityValue.Add("iquest", 191); // inverted question mark = turned question mark, U+00BF ISOnum
            EntityName.Add(191, "iquest");
            EntityValue.Add("Agrave", 192);

            // latin capital letter A with grave = latin capital letter A grave, U+00C0 ISOlat1
            EntityName.Add(192, "Agrave");
            EntityValue.Add("Aacute", 193); // latin capital letter A with acute, U+00C1 ISOlat1
            EntityName.Add(193, "Aacute");
            EntityValue.Add("Acirc", 194); // latin capital letter A with circumflex, U+00C2 ISOlat1
            EntityName.Add(194, "Acirc");
            EntityValue.Add("Atilde", 195); // latin capital letter A with tilde, U+00C3 ISOlat1
            EntityName.Add(195, "Atilde");
            EntityValue.Add("Auml", 196); // latin capital letter A with diaeresis, U+00C4 ISOlat1
            EntityName.Add(196, "Auml");
            EntityValue.Add("Aring", 197);

            // latin capital letter A with ring above = latin capital letter A ring, U+00C5 ISOlat1
            EntityName.Add(197, "Aring");
            EntityValue.Add("AElig", 198); // latin capital letter AE = latin capital ligature AE, U+00C6 ISOlat1
            EntityName.Add(198, "AElig");
            EntityValue.Add("Ccedil", 199); // latin capital letter C with cedilla, U+00C7 ISOlat1
            EntityName.Add(199, "Ccedil");
            EntityValue.Add("Egrave", 200); // latin capital letter E with grave, U+00C8 ISOlat1
            EntityName.Add(200, "Egrave");
            EntityValue.Add("Eacute", 201); // latin capital letter E with acute, U+00C9 ISOlat1
            EntityName.Add(201, "Eacute");
//.........这里部分代码省略.........
开发者ID:MGramolini,项目名称:vodca,代码行数:101,代码来源:HtmlEntity.cs

示例9: SelectAllMediaItemAspectMetadataCreationDates

 protected static IDictionary<Guid, DateTime> SelectAllMediaItemAspectMetadataCreationDates()
 {
   var database = ServiceRegistration.Get<ISQLDatabase>();
   var transaction = database.BeginTransaction();
   try
   {
     int miamIdIndex;
     int creationDateIndex;
     using (var command = MediaLibrary_SubSchema.SelectAllMediaItemAspectMetadataCreationDatesCommand(transaction, out miamIdIndex, out creationDateIndex))
     using (var reader = command.ExecuteReader())
     {
       IDictionary<Guid, DateTime> result = new ConcurrentDictionary<Guid, DateTime>();
       while (reader.Read())
         result.Add(database.ReadDBValue<Guid>(reader, miamIdIndex),
             database.ReadDBValue<DateTime>(reader, creationDateIndex));
       return result;
     }
   }
   finally
   {
     transaction.Dispose();
   }      
 }
开发者ID:davinx,项目名称:MediaPortal-2,代码行数:23,代码来源:MIA_Management.cs

示例10: CreateTestDatabase

        /// <summary>
        /// Create a test database with two players.
        /// </summary>
        public void CreateTestDatabase()
        {
            IDictionary<String, Player> players = new ConcurrentDictionary<String, Player>();
            players.Add("James", new Player(new Position(200, 200), new Velocity(0, 0), "James", "jamespass"));
            players.Add("Gleb", new Player(new Position(400, 300), new Velocity(0, 0), "Gleb", "glebpass"));

            CreateDatabase(players);
        }
开发者ID:menohack,项目名称:GlebForgeServer,代码行数:11,代码来源:PlayerDatabase.cs

示例11: RunDictionaryTest_Add1

        private static bool RunDictionaryTest_Add1(int cLevel, int initSize, int threads, int addsPerThread)
        {
            TestHarness.TestLog(
                "* RunDictionaryTest_Add1(cLevel={0}, initSize={1}, threads={2}, addsPerThread={3})",
                cLevel, initSize, threads, addsPerThread);

            IDictionary<int, int> dict = new ConcurrentDictionary<int, int>(cLevel, 1);

            int count = threads;
            using (ManualResetEvent mre = new ManualResetEvent(false))
            {
                for (int i = 0; i < threads; i++)
                {
                    int ii = i;
                    ThreadPool.QueueUserWorkItem(
                        (o) =>
                        {
                            for (int j = 0; j < addsPerThread; j++)
                            {
                                dict.Add(j + ii * addsPerThread, -(j + ii * addsPerThread));
                            }
                            if (Interlocked.Decrement(ref count) == 0) mre.Set();
                        });
                }
                mre.WaitOne();
            }

            if (dict.Any(pair => pair.Key != -pair.Value))
            {
                TestHarness.TestLog("  > Invalid value for some key in the dictionary.");
                return false;
            }

            var gotKeys = dict.Select(pair => pair.Key).OrderBy(i => i).ToArray();
            var expectKeys = Enumerable.Range(0, threads * addsPerThread);

            if (!gotKeys.SequenceEqual(expectKeys))
            {
                TestHarness.TestLog("  > The set of keys in the dictionary is invalid.");
                return false;
            }

            // Finally, let's verify that the count is reported correctly.
            int expectedCount = threads * addsPerThread;
            if (dict.Count != expectedCount || dict.ToArray().Length != expectedCount || dict.ToList().Count() != expectedCount)
            {
                TestHarness.TestLog("  > Incorrect count of elements reported for the dictionary.");
                return false;
            }

            return true;
        }
开发者ID:modulexcite,项目名称:IL2JS,代码行数:52,代码来源:ConcurrentDictionaryTests.cs

示例12: GetData

        /// <summary>
        /// IP Details From IP Address
        /// </summary>
        /// <param name="ip">
        /// The ip.
        /// </param>
        /// <param name="format">
        /// The format.
        /// </param>
        /// <param name="callback">
        /// The callback.
        /// </param>
        /// <param name="culture">
        /// The culture.
        /// </param>
        /// <param name="browser">
        /// The browser.
        /// </param>
        /// <param name="os">
        /// The os.
        /// </param>
        /// <returns>
        /// IPLocator Class
        /// </returns>
        public IDictionary<string, string> GetData([CanBeNull] string ip, [CanBeNull] string format, bool callback, string culture, string browser, string os)
        {
            CodeContracts.ArgumentNotNull(ip, "ip");

            IDictionary<string, string> res = new ConcurrentDictionary<string, string>();

            if (YafContext.Current.Get<YafBoardSettings>().IPLocatorResultsMap.IsNotSet() ||
                YafContext.Current.Get<YafBoardSettings>().IPLocatorUrlPath.IsNotSet())
            {
                return res;
            }

            if (YafContext.Current.Get<YafBoardSettings>().EnableIPInfoService)
            {
                switch (format)
                {
                    case "raw":
                        try
                        {
                            string path =
                                YafContext.Current.Get<YafBoardSettings>()
                                    .IPLocatorUrlPath.FormatWith(VZF.Utils.Helpers.IPHelper.GetIp4Address(ip));
                            var client = new WebClient();
                            string[] result = client.DownloadString(path).Split(';');
                            string[] sray =
                                YafContext.Current.Get<YafBoardSettings>().IPLocatorResultsMap.Trim().Split(',');
                            if (result.Length > 0 && result.Length == sray.Length)
                            {
                                int i = 0;
                                bool oldproperty = false;
                                foreach (string str in result)
                                {
                                    if (sray.Any(strDef => string.Equals(str, strDef, StringComparison.InvariantCultureIgnoreCase)))
                                    {
                                        res.Add(sray[i].Trim(), str);
                                        i++;
                                        oldproperty = true;
                                    }

                                    if (!oldproperty)
                                    {
                                        CommonDb.eventlog_create(YafContext.Current.PageModuleID, this, "Undefined property {0} in your HostSettings IP Info Geolocation Web Service arguments mapping string. Automatically added to the string.".FormatWith(str), EventLogTypes.Information);
                                        string oldProperties =
                                            YafContext.Current.Get<YafBoardSettings>().IPLocatorResultsMap;
                                        YafContext.Current.Get<YafBoardSettings>().IPLocatorResultsMap = oldProperties
                                                                                                             + ","
                                                                                                             + str;
                                    }

                                    oldproperty = false;
                                }
                            }
                        }
                        catch
                        {
                            return res;
                        }

                        break;
                    case "xml":
                        break;
                    case "json":
                        break;
                }
            }

            return res;
        }
开发者ID:vzrus,项目名称:VZF,代码行数:92,代码来源:IPLocator.cs

示例13: LoadSettings

        /// <summary>
        /// 讀取指定路徑的Xml設定檔,轉成來源端列表與目的端列表的字典檔
        /// </summary>
        /// <param name="filePath"></param>
        /// <returns></returns>
        public IDictionary<IList<IPEndPoint>, IList<IPEndPoint>> LoadSettings(string filePath)
        {
            IDictionary<IList<IPEndPoint>, IList<IPEndPoint>> ipEndPointDic = new ConcurrentDictionary<IList<IPEndPoint>, IList<IPEndPoint>>();
            //load xml file
            XDocument doc = XDocument.Load(filePath, LoadOptions.None);

            IEnumerable<XElement> ipEndPointList = doc.Root.Elements("IPEndPoint");
            IEnumerable<XElement> originNodes = null;
            IEnumerable<XElement> destinationNodes = null;
            //loop all Tag that name is IPEndPoint
            foreach (var ipEndPointNode in ipEndPointList)
            {
                if (ipEndPointNode.HasElements)
                {
                    //get this endpoint inner settings
                    //loading origin ip list setting
                    originNodes = ipEndPointNode.Elements("Origin");
                    //loading destination ip list setting
                    destinationNodes = ipEndPointNode.Elements("Destination");
                    //parse origin ip list setting
                    IList<IPEndPoint> originlist = GetIpEndPointList(originNodes, "Origin");
                    //parse destination ip list setting
                    IList<IPEndPoint> destinationlist = GetIpEndPointList(destinationNodes, "Destination");
                    //insert to dictionary
                    ipEndPointDic.Add(originlist, destinationlist);
                }
            }
            return ipEndPointDic;
        }
开发者ID:knarf7112,项目名称:SocketServer,代码行数:34,代码来源:SocketProxy.cs

示例14: GetTemplateCompilationTaskMap

        /// <summary>Compiles the referenced XSLT for all templates.</summary>
        private IDictionary<Template, Task<XslCompiledTransform>> GetTemplateCompilationTaskMap() {
            IDictionary<Template, Task<XslCompiledTransform>> templateTransformTaskMap = new ConcurrentDictionary<Template, Task<XslCompiledTransform>>();

            foreach (Template template in this.TemplateOutputs.Keys) {
                OnTemplateGenerationStatus(TemplateGenerationStatusEventArgs.CreateCompiling(template));

                try {
                    templateTransformTaskMap.Add(template, CompileTemplateAsync(template));
                }
                catch (Exception ex) {
                    Generator.Logger.Error(ex);
                    OnTemplateGenerationStatus(TemplateGenerationStatusEventArgs.CreateError(template, new ApplicationException("Unable to load XSLT.", ex)));
                    break;
                }

                OnTemplateGenerationStatus(TemplateGenerationStatusEventArgs.CreateWaiting(template));
            }

            return templateTransformTaskMap;
        }
开发者ID:QuantumConcepts,项目名称:CodeGenerator,代码行数:21,代码来源:Generator.cs

示例15: ValuesController

		static ValuesController()
		{
			DefaultItems = new ConcurrentDictionary<string, string>(StringComparer.InvariantCultureIgnoreCase);
			DefaultItems.Add("key1", "value1");
			DefaultItems.Add("key2", "value2");
		}
开发者ID:gusztavvargadr,项目名称:GitTools-GitVersion.Samples,代码行数:6,代码来源:ValuesController.cs


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