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


C# System.Collections.Generic.ToArray方法代码示例

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


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

示例1: GetIdentityMappings

        /// <summary>
        /// Gets a mapping that can be used with NHibernate.
        /// </summary>
        /// <param name="additionalTypes">Additional Types that are to be added to the mapping, this is useful for adding your ApplicationUser class</param>
        /// <returns></returns>
        public static HbmMapping GetIdentityMappings(System.Type[] additionalTypes)
        {
            var baseEntityToIgnore = new[]
            {
                typeof(EntityWithTypedId<int>),
                typeof(EntityWithTypedId<string>)
            };

            // Modified for NS: PIMS.Infrastructure.NHibernate.NHAspNetIdentity
            var allEntities = new List<System.Type> {
                typeof(IdentityUser),
                typeof(IdentityRole),
                typeof(IdentityUserLogin),
                typeof(IdentityUserClaim),
            };
            allEntities.AddRange(additionalTypes);

            var mapper = new ConventionModelMapper();
            DefineBaseClass(mapper, baseEntityToIgnore.ToArray());
            mapper.IsComponent((type, declared) => typeof(ValueObject).IsAssignableFrom(type));

               // Modified for NS: PIMS.Infrastructure.NHibernate.NHAspNetIdentity
            mapper.AddMapping<IdentityUserMap>();
            mapper.AddMapping<IdentityRoleMap>();
            mapper.AddMapping<IdentityUserClaimMap>();

            return mapper.CompileMappingFor(allEntities);
        }
开发者ID:RichardPAsch,项目名称:PIMS,代码行数:33,代码来源:MappingHelper.cs

示例2: IterationTest

        public void IterationTest()
        {
            var testValues = new[] {1, 2, 3};

            var enumerator = new List<int>(testValues.ToArray()).GetEnumerator();

            using(var enumeratorWrapper = new EnumeratorWrapper<string>(enumerator, value => value.ToString()))
            {
                foreach(var testValue in testValues)
                {
                    enumeratorWrapper.MoveNext();

                    Assert.AreEqual(testValue.ToString(CultureInfo.InvariantCulture), enumeratorWrapper.Current);
                }
            }
        }
开发者ID:HansKindberg-Net,项目名称:HansKindberg,代码行数:16,代码来源:EnumeratorWrapperTest.cs

示例3: FindMinimumLatency_Case9

        public void FindMinimumLatency_Case9()
        {
            // Assign
            var gamsrv = new Gamsrv();
            var lines = new[]
            {
                "25 40", "1 2 3 4 5 6 10 11 15 16 20 21 22 23 24 25",
                "1 2 10", "2 3 10", "3 4 10", "4 5 10", "1 6 10", "2 7 10", "6 7 10",
                "3 8 10", "7 8 10", "4 9 10", "8 9 10", "5 10 10", "9 10 10", "6 11 10",
                "7 12 10", "11 12 10", "8 13 10", "12 13 10", "9 14 10", "13 14 10",
                "10 15 10", "14 15 10", "11 16 10", "12 17 10", "16 17 10", "13 18 10",
                "17 18 10", "14 19 10", "18 19 10", "15 20 10", "19 20 10", "16 21 10",
                "17 22 10", "21 22 10", "18 23 10", "22 23 10", "19 24 10", "23 24 10",
                "20 25 10", "24 25 10"
            };
            long expected = 40;

            // Act
            var actual = gamsrv.FindMinimumLatency(lines.ToArray());

            // Assert
            Assert.AreEqual(expected, actual);
        }
开发者ID:JustMeGaaRa,项目名称:Silent.Algorithms,代码行数:23,代码来源:GamsrvTests.cs

示例4: can_except

 public void can_except()
 {
     var x = new[] { 1, 2 }.Except(new[] { 2 });
     Assert.AreEqual(1, x.ToArray()[0]);
 }
开发者ID:bjornebjornson,项目名称:LottoNh2,代码行数:5,代码来源:_IEnumerableIntersect.cs

示例5: cant_edit_IEnumerable_int

 public void cant_edit_IEnumerable_int()
 {
     IEnumerable<int> sut = new [] {1};
     sut.ToArray()[0] = 2;
     Assert.IsFalse(sut.SequenceEqual(new []{2}));
 }
开发者ID:bjornebjornson,项目名称:LottoNh2,代码行数:6,代码来源:_IEnumerableIntersect.cs

示例6: SimulateKeyPress

		/// <summary>
		///   Simulate that a given key is pressed. (Down and up)
		/// </summary>
		public static void SimulateKeyPress( Key key )
		{
			var virtualKey = (ushort)KeyInterop.VirtualKeyFromKey( key );
			var keyPress = new []
			{
				new User32.Input
				{
					Type = User32.InputEventType.Keyboard,
					InputInformation = new User32.InputUnion
					{
						KeyboardInput = new User32.KeyboardInput
						{
							VirtualKey = virtualKey,
						}
					}
				},
				new User32.Input
				{
					Type = User32.InputEventType.Keyboard,
					InputInformation = new User32.InputUnion
					{
						KeyboardInput = new User32.KeyboardInput
						{
							VirtualKey = virtualKey,
							Flags = User32.KeyboardInputFlags.KeyUp
						}
					}
				}
			};

			uint succeededEvents = User32.SendInput( (uint)keyPress.Length, keyPress.ToArray(), User32.Input.Size );
			if ( keyPress.Length != 0 && succeededEvents != keyPress.Length )
			{
				MarshalHelper.ThrowLastWin32ErrorException();
			}
		}
开发者ID:amithasan,项目名称:Framework-Class-Library-Extension,代码行数:39,代码来源:KeyHelper.cs


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