本文整理汇总了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;
}
示例2: test
public static Boolean test(Integer n1, Long n2) {
if (n1 < n2) {
return true;
} else {
return false;
}
}
示例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));
}
示例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();
}
}
}
示例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;
}
示例6: test
public static bool test() {
Integer x = 1;
Integer y = new Integer(1);
if (x == y)
return true;
else
return false;
}
示例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();
}
示例8: next
public Integer next() {
if (nextValue != null)
{
int temp = nextValue;
nextValue = null;
return temp;
}
else return itr.next();
}
示例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));
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例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)
};
}
示例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);
}
}