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


C# Integer类代码示例

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


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

示例1: peek

 // Returns the next element in the iteration without advancing the iterator.
 public Integer peek() {
     if (nextValue == null)
     {
         nextValue = this.next();
     }
     return nextValue;
 }
开发者ID:einstenwolfgang,项目名称:leetcode-exercise,代码行数:8,代码来源:Peeking+Iterator.cs

示例2: test

	public static Boolean test(Integer n1, Long n2) {
		if (n1 < n2) {
			return true;
		} else {
			return false;
		}
	}
开发者ID:nagyistoce,项目名称:cnatural-language,代码行数:7,代码来源:AutoboxingBinary2.stab.cs

示例3: Main

 static void Main()
 {
     Integer Num = new Integer(3);
     Console.WriteLine("덧셈 : " + Num.Add(2));
     Console.WriteLine("곱셈 : " + Num.Mul(2));
     Console.WriteLine("뺄셈 : " + Num.Sub(2));
 }
开发者ID:gawallsibya,项目名称:BIT_MFC-CShap-DotNet,代码行数:7,代码来源:Program.cs

示例4: ExclusiveTask

        private async Task ExclusiveTask(SemaphoreSlim s, Integer count, int seed, int iteration, bool due)
        {
            var r = new Random(seed);

            if (due)
            {
                try
                {
                    await Delay(r).ConfigureAwait(false);
                }
                catch { }
            }

            for (int i = 0; i < iteration; i++)
            {
                int localCount = 0;
                try
                {
                    await s.WaitAsync();
                    localCount = count.Value;
                    await Delay(r).ConfigureAwait(false);
                }
                catch (TestException) { }
                finally
                {
                    count.Value = localCount + 1;
                    s.Release();
                }
            }
        }
开发者ID:ch896,项目名称:MinimumAsyncBridge,代码行数:30,代码来源:UnitTestSemaphoreSlim.cs

示例5: NetflixMovie

		public NetflixMovie(Integer id, String title) 
		{
			if (id == null || title == null) {
				throw new ArgumentNullException("ID or title is null");
			}
			this.id = id;
			this.title = title;
		}
开发者ID:ccollie,项目名称:taste.net,代码行数:8,代码来源:NetflixMovie.cs

示例6: test

	public static bool test() {
		Integer x = 1;
		Integer y = new Integer(1);
		if (x == y)
			return true;
		else
			return false;
	}
开发者ID:nagyistoce,项目名称:cnatural-language,代码行数:8,代码来源:AutoboxingEqual2.stab.cs

示例7: Main

        static void Main(string[] args)
        {
            Integer integer = new Integer(21);
            Method(integer);
            Console.WriteLine("From Integer instance in Method: " + integer.Integer1);

            Console.ReadLine();
        }
开发者ID:jbakolas,项目名称:DotNetSamples,代码行数:8,代码来源:Program.cs

示例8: next

 public Integer next() {
     if (nextValue != null)
     {
         int temp = nextValue;
         nextValue = null;
         return temp;
     }
     else return itr.next();
 }
开发者ID:einstenwolfgang,项目名称:leetcode-exercise,代码行数:9,代码来源:Peeking+Iterator.cs

示例9: IntegerEnsureMaxIsNotExceeded

 public void IntegerEnsureMaxIsNotExceeded()
 {
     // Arrange
     Integer my_int = new Integer();
     // Act
     int[] actual = my_int.GetSequence(my_int.Max+1);
     // This is a call the uses an older testing framework. (e.g. Koans)
     //Assert.Throws(typeof(Exception), my_int.GetSequence(my_int.Max));
 }
开发者ID:jcockhren,项目名称:mathmagician,代码行数:9,代码来源:IntegerTests.cs

示例10: IntegerEnsureICanGetFirstNumber

        public void IntegerEnsureICanGetFirstNumber()
        {
            // Arrange - Scenario Setup
            Integer my_int = new Integer();

            // Act - Do the thing you want to test
            int actual = my_int.GetFirst();
            int expected = 0;

            // Assert - Did it work as expected?
            Assert.AreEqual(expected, actual);
        }
开发者ID:jcockhren,项目名称:mathmagician,代码行数:12,代码来源:IntegerTests.cs

示例11: IntegerEnsureICanCreateASequenceOfTenIntegers

        public void IntegerEnsureICanCreateASequenceOfTenIntegers()
        {
            // Arrange
            Integer my_int = new Integer();

            // Act
            int[] actual = my_int.GetSequence(10);
            int[] expected = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };

            // Assert
            CollectionAssert.AreEqual(expected, actual);
        }
开发者ID:jcockhren,项目名称:mathmagician,代码行数:12,代码来源:IntegerTests.cs

示例12: IntegerEnsureICanGetNextInteger

        public void IntegerEnsureICanGetNextInteger()
        {
            // Arrange
            Integer my_int = new Integer();

            // Act

            int actual = my_int.GetNext(5);
            int expected = 6;

            // Assert
            Assert.AreEqual(expected, actual);
        }
开发者ID:jcockhren,项目名称:mathmagician,代码行数:13,代码来源:IntegerTests.cs

示例13: test

	public static bool test() {
		var list = Query.range(0, 5).toList();
		var array1 = new Integer[5];
		var array2 = list.toArray(array1);
		if (array1 != array2) {
			return false;
		}
		for (int i = 0; i < sizeof(array1); i++) {
			if (!array1[i].equals(i)) {
				return false;
			}
		}
		return true;
	}
开发者ID:nagyistoce,项目名称:cnatural-language,代码行数:14,代码来源:IntList5.stab.cs

示例14: RSAPrivateKey

 public RSAPrivateKey(Integer version, Integer modulus, Integer publicExponent, Integer privateExponent, Integer prime1, Integer prime2, Integer exponent1, Integer exponent2, Integer coefficient)
     : base(version, modulus, publicExponent, privateExponent, prime1, prime2, exponent1, exponent2, coefficient)
 {
     Key = new RSAParameters()
     {
         Modulus = AddPadding(modulus.UnencodedValue),
         Exponent = publicExponent.UnencodedValue, // the exponent does not require padding
         D = AddPadding(privateExponent.UnencodedValue),
         P = AddPadding(prime1.UnencodedValue),
         Q = AddPadding(prime2.UnencodedValue),
         DP = AddPadding(exponent1.UnencodedValue),
         DQ = AddPadding(exponent2.UnencodedValue),
         InverseQ = AddPadding(coefficient.UnencodedValue)
     };
 }
开发者ID:Xamarui,项目名称:acme.net,代码行数:15,代码来源:RSAPrivateKey.cs

示例15: TestWaitAsyncInternal

        private async Task TestWaitAsyncInternal(int parallel, int innerLoop, int outerLoop, bool due)
        {
            var r = new Random();
            var s = new SemaphoreSlim(1);

            for (int i = 0; i < outerLoop; i++)
            {
                var count = new Integer();

                await Task.WhenAll(Enumerable.Range(0, parallel)
                    .Select(_ => ExclusiveTask(s, count, r.Next(), innerLoop, due))
                    .ToArray());

                Assert.AreEqual(parallel * innerLoop, count.Value);
            }
        }
开发者ID:ch896,项目名称:MinimumAsyncBridge,代码行数:16,代码来源:UnitTestSemaphoreSlim.cs


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