コード例 #1
0
        public void TryAddPresent()
        {
            var ocd = new OrderedConcurrentDictionary <int, string>();

            ocd.TryAdd(1, "one");
            Assert.False(ocd.TryAdd(1, "not one"));
            Assert.Equal("one", ocd[1]);
        }
コード例 #2
0
        public void TryAddNotPresent()
        {
            var ocd = new OrderedConcurrentDictionary <int, string>();

            Assert.True(ocd.TryAdd(1, "one"));
        }