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


C# ValueItem类代码示例

本文整理汇总了C#中ValueItem的典型用法代码示例。如果您正苦于以下问题:C# ValueItem类的具体用法?C# ValueItem怎么用?C# ValueItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: Test2_Negative

 public static void Test2_Negative()
 {
     HashSet<ValueItem> hashSet = new HashSet<ValueItem>();
     ValueItem[] items = new ValueItem[0];
     HashSetTestSupport<ValueItem> driver = new HashSetTestSupport<ValueItem>(hashSet, ValueItem.GenerateNext, items);
     driver.VerifyHashSet_NegativeTests();
 }
开发者ID:johnhhm,项目名称:corefx,代码行数:7,代码来源:HashSet_ConstructorTests.cs

示例2: OnMassItemValueChanged

 void OnMassItemValueChanged(ValueItem massItem)
 {
     if (_massItem == massItem) {
         _rb.mass = _massItem.Value * Config.Instance.density;
         transform.localScale = Vector3.one * Mathf.Pow (_massItem.Value * 3 / 4, 1.0f / 3);
     }
 }
开发者ID:IllusionCui,项目名称:RollABoll,代码行数:7,代码来源:GameItem.cs

示例3: SetupTest4

            //Test 4 - Set/Item Comparer Test 4
            public static void SetupTest4(out HashSet<ValueItem> set, out IEnumerable<ValueItem> other)
            {
                List<ValueItem> list = new List<ValueItem>();
                ValueItem item1 = new ValueItem(134, -15);
                ValueItem item2 = new ValueItem(14, 14);
                ValueItem item3 = new ValueItem(19999, -12);
                ValueItem innerItem;

                SetItemComparerTests.SetupTest4(out set, out innerItem);

                list.Add(item1);
                list.Add(item2);
                list.Add(item3);
                list.Add(innerItem);

                other = list;
            }
开发者ID:er0dr1guez,项目名称:corefx,代码行数:18,代码来源:SetCollectionComparerTests.cs

示例4: SetupTest1

            //Test 1: other collection is multi-item with duplicates, set is empty
            public static void SetupTest1(out HashSet<ValueItem> set, out IEnumerable<ValueItem> other)
            {
                List<ValueItem> list = new List<ValueItem>();

                ValueItem item1 = new ValueItem(34, -5);
                ValueItem item2 = new ValueItem(4, 4);
                ValueItem item3 = new ValueItem(9999, -2);
                ValueItem item4 = new ValueItem(99, -2);

                list.Add(item1);
                list.Add(item2);
                list.Add(item2);
                list.Add(item3);
                list.Add(item4);
                list.Add(item4);

                set = new HashSet<ValueItem>();
                other = list;
            }
开发者ID:noahfalk,项目名称:corefx,代码行数:20,代码来源:SetCollectionDuplicateItemTests.cs

示例5: Overlaps_Test61

        public static void Overlaps_Test61()
        {
            HashSet<ValueItem> hashSet;
            IEnumerable<ValueItem> other;
            bool ret;
            ValueItem item2 = new ValueItem(4, 4);

            SetCollectionDuplicateItemTests.SetupTest4(out hashSet, out other);
            ret = hashSet.Overlaps(other);
            Assert.True(ret); //"Error: Overlaps returned wrong value."

            HashSetTestSupport<ValueItem>.VerifyHashSet(hashSet, new ValueItem[] { item2 }, hashSet.Comparer);
        }
开发者ID:noahfalk,项目名称:corefx,代码行数:13,代码来源:HashSet_OverlapsTests.cs

示例6: IsExceptWith_Test56

        public static void IsExceptWith_Test56()
        {
            HashSet<ValueItem> hashSet;
            IEnumerable<ValueItem> other;
            ValueItem item1 = new ValueItem(340, -5);
            ValueItem item2 = new ValueItem(4, 4);

            SetCollectionComparerTests.SetupTest14(out hashSet, out other);
            hashSet.ExceptWith(other);

            HashSetTestSupport<ValueItem>.VerifyHashSet(hashSet, new ValueItem[] { item1, item2 }, hashSet.Comparer);
        }
开发者ID:noahfalk,项目名称:corefx,代码行数:12,代码来源:HashSet_ExceptWithTests.cs

示例7: IsProperSupersetOf_Test65

        public static void IsProperSupersetOf_Test65()
        {
            HashSet<ValueItem> hashSet;
            IEnumerable<ValueItem> other;
            bool ret;
            ValueItem itemo1 = new ValueItem(34, -5);
            ValueItem itemo2 = new ValueItem(4, 4);
            ValueItem itemo3 = new ValueItem(9999, -2);
            ValueItem itemo4 = new ValueItem(99, -2);
            ValueItem items1 = new ValueItem(-34, 5);
            ValueItem items2 = new ValueItem(-4, -4);
            ValueItem items3 = new ValueItem(-9999, 2);
            ValueItem items4 = new ValueItem(-99, 2);

            SetCollectionDuplicateItemTests.SetupTest8(out hashSet, out other);
            ret = hashSet.IsProperSupersetOf(other);
            Assert.True(ret); //"Error: IsProperSupersetOf returned wrong value."

            HashSetTestSupport<ValueItem>.VerifyHashSet(hashSet, new ValueItem[] { items1, items2, items3, items4, itemo1, itemo2, itemo3, itemo4 }, hashSet.Comparer);
        }
开发者ID:noahfalk,项目名称:corefx,代码行数:20,代码来源:HashSet_IsProperSupersetOfTests.cs

示例8: SetupTest3

            //Test 3
            // item same as element in set by sets comparer, different by default comparer - set contains item that is equal by default comparer
            public static void SetupTest3(out HashSet<ValueItem> set, out ValueItem item)
            {
                set = new HashSet<ValueItem>(new ValueItemYEqualityComparer());
                set.Add(new ValueItem(34, -5));
                set.Add(new ValueItem(4, 4));
                set.Add(new ValueItem(9999, -2));

                item = new ValueItem(34, -2);
            }
开发者ID:er0dr1guez,项目名称:corefx,代码行数:11,代码来源:SetCollectionComparerTests.cs

示例9: HashSetConstructor_IEn_IEq_Comparer_Default

 public static void HashSetConstructor_IEn_IEq_Comparer_Default()
 {
     IEqualityComparer<ValueItem> defaultComparer = EqualityComparer<ValueItem>.Default;
     ValueItem[] items = new ValueItem[] { new ValueItem(1, -1), new ValueItem(2, -2), new ValueItem(3, -3), new ValueItem(4, -4) };
     HashSet<ValueItem> hashSet = new HashSet<ValueItem>(items, defaultComparer);
     HashSetTestSupport<ValueItem> driver = new HashSetTestSupport<ValueItem>(hashSet, ValueItem.GenerateNext, items, defaultComparer);
     driver.VerifyHashSetTests();
 }
开发者ID:johnhhm,项目名称:corefx,代码行数:8,代码来源:HashSet_ConstructorTests.cs

示例10: IsIntersectWith_Test56

        public static void IsIntersectWith_Test56()
        {
            HashSet<ValueItem> hashSet;
            IEnumerable<ValueItem> other;
            ValueItem item3 = new ValueItem(9999, -2);

            SetCollectionComparerTests.SetupTest14(out hashSet, out other);
            hashSet.IntersectWith(other);

            HashSetTestSupport<ValueItem>.VerifyHashSet(hashSet, new ValueItem[] { item3 }, hashSet.Comparer);
        }
开发者ID:noahfalk,项目名称:corefx,代码行数:11,代码来源:HashSet_IntersectWithTests.cs

示例11: IsIntersectWith_Test69

        public static void IsIntersectWith_Test69()
        {
            HashSet<ValueItem> hashSet;
            IEnumerable<ValueItem> other;
            ValueItem items2 = new ValueItem(-4, -4);

            SetCollectionDuplicateItemTests.SetupTest12(out hashSet, out other);
            hashSet.IntersectWith(other);

            HashSetTestSupport<ValueItem>.VerifyHashSet(hashSet, new ValueItem[] { items2 }, hashSet.Comparer);
        }
开发者ID:noahfalk,项目名称:corefx,代码行数:11,代码来源:HashSet_IntersectWithTests.cs

示例12: UnionWith_Test52

            public static void UnionWith_Test52()
            {
                ValueItem itemn4 = new ValueItem(-4, -4);
                ValueItem itemn3 = new ValueItem(-3, -3);
                ValueItem itemn2 = new ValueItem(-2, -2);
                ValueItem itemn1 = new ValueItem(-1, -1);
                ValueItem item1 = new ValueItem(1, 1);
                ValueItem item2 = new ValueItem(2, 2);
                ValueItem item3 = new ValueItem(3, 3);
                ValueItem item4 = new ValueItem(4, 4);

                HashSet<IEnumerable> itemhs1 = new HashSet<IEnumerable>(new ValueItem[] { item1, item2, item3, item4 });
                HashSet<IEnumerable> itemhs2 = new HashSet<IEnumerable>(new ValueItem[] { itemn1, itemn2, itemn3, itemn4 });
                HashSet<IEnumerable> inneritem = new HashSet<IEnumerable>();

                HashSet<HashSet<IEnumerable>> hashSet;
                IEnumerable<HashSet<IEnumerable>> other;

                SetCollectionComparerTests.SetupTest10(out hashSet, out other);
                inneritem.Add(hashSet);
                hashSet.UnionWith(other);

                HashSet<IEnumerable>[] expected = new HashSet<IEnumerable>[] { itemhs1, itemhs2, inneritem };
                HashSet<IEnumerable>[] actual = new HashSet<IEnumerable>[3];
                hashSet.CopyTo(actual, 0, 3);

                Assert.Equal(3, hashSet.Count); //"Should be equal"
                HashSetTestSupport.HashSetContains(actual, expected);
            }
开发者ID:er0dr1guez,项目名称:corefx,代码行数:29,代码来源:HashSet_UnionWithTests.cs

示例13: UnionWith_Test61

            public static void UnionWith_Test61()
            {
                HashSet<ValueItem> hashSet;
                IEnumerable<ValueItem> other;
                ValueItem item1 = new ValueItem(34, -5);
                ValueItem item2 = new ValueItem(4, 4);
                ValueItem item3 = new ValueItem(9999, -2);
                ValueItem item4 = new ValueItem(99, -2);

                SetCollectionDuplicateItemTests.SetupTest4(out hashSet, out other);
                hashSet.UnionWith(other);

                HashSetTestSupport<ValueItem>.VerifyHashSet(hashSet, new ValueItem[] { item1, item2, item3, item4 }, hashSet.Comparer);
            }
开发者ID:er0dr1guez,项目名称:corefx,代码行数:14,代码来源:HashSet_UnionWithTests.cs

示例14: Contains_Test20

        public static void Contains_Test20()
        {
            HashSet<HashSet<IEnumerable>> hashSet;
            HashSet<IEnumerable> item;
            ValueItem itemn4 = new ValueItem(-4, -4);
            ValueItem itemn3 = new ValueItem(-3, -3);
            ValueItem itemn2 = new ValueItem(-2, -2);
            ValueItem itemn1 = new ValueItem(-1, -1);
            ValueItem item1 = new ValueItem(1, 1);
            ValueItem item2 = new ValueItem(2, 2);
            ValueItem item3 = new ValueItem(3, 3);
            ValueItem item4 = new ValueItem(4, 4);
            HashSet<IEnumerable> itemhs1 = new HashSet<IEnumerable>(new ValueItem[] { item1, item2, item3, item4 });
            HashSet<IEnumerable> itemhs2 = new HashSet<IEnumerable>(new ValueItem[] { itemn1, itemn2, itemn3, itemn4 });

            SetItemComparerTests.SetupTest5(out hashSet, out item);
            bool contains = hashSet.Contains(item);
            Assert.True(contains); //"Error: Contains returned wrong value"

            HashSet<IEnumerable>[] expected = new HashSet<IEnumerable>[] { itemhs1, itemhs2, item };
            HashSet<IEnumerable>[] actual = new HashSet<IEnumerable>[3];
            hashSet.CopyTo(actual, 0, 3);

            Assert.Equal(3, hashSet.Count); //"Should be equal."
            HashSetTestSupport.HashSetContains(actual, expected);
        }
开发者ID:er0dr1guez,项目名称:corefx,代码行数:26,代码来源:HashSet_ContainsTests.cs

示例15: UnionWith_Test46

            public static void UnionWith_Test46()
            {
                HashSet<ValueItem> hashSet;
                IEnumerable<ValueItem> other;
                ValueItem item1 = new ValueItem(340, -5);
                ValueItem item2 = new ValueItem(4, 4);
                ValueItem item3 = new ValueItem(9999, -2);
                ValueItem itemo1 = new ValueItem(134, -15);
                ValueItem itemo2 = new ValueItem(14, 14);
                ValueItem itemo3 = new ValueItem(19999, -12);

                SetCollectionComparerTests.SetupTest4(out hashSet, out other);
                hashSet.UnionWith(other);

                HashSetTestSupport<ValueItem>.VerifyHashSet(hashSet, new ValueItem[] { item1, item2, item3, itemo1, itemo2, itemo3 }, hashSet.Comparer);
            }
开发者ID:er0dr1guez,项目名称:corefx,代码行数:16,代码来源:HashSet_UnionWithTests.cs


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