本文整理汇总了C#中Integer类的典型用法代码示例。如果您正苦于以下问题:C# Integer类的具体用法?C# Integer怎么用?C# Integer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Integer类属于命名空间,在下文中一共展示了Integer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: Main
public override void Main()
{
foreach(var ship in MyShip.SRS)
{
Response.Add(ship.GetNameHtmlAndID());
Response.Add(new CHtmlBreak());
}
Array<Integer> a = new Integer[]{ 4, 9 };
Integer n = a[1];
Array<Integer> b = new Integer[5,n*2];
Integer n2 = b[4, 0];
WriteLine(n + " " + n2);
foreach(var i in a)
{
WriteLine(i + " is in a");
}
}
开发者ID:TheJP,项目名称:Stne,代码行数:17,代码来源:Sample5.cs
示例17: Main
static public void Main(string[] args)
{
BinaryFormatter formatter = new BinaryFormatter();
Console.WriteLine("record size\trecords written\tbytes per record\trecords per sec\tintegers per sec");
for (int n=1; n<50000; n=(int)(1.2*n)+1)
{
using (FileStream fos = new FileStream("tmp.tmp", FileMode.Create, FileAccess.Write))
{
Thread.Sleep(1000); //Wait for any disk activity to stop.
Integer[] d = new Integer[n];
for (int k=0; k<n; k++)
{
d[k] = new Integer((int)(rand.NextDouble()*k));
}
start();
int max = 1000;
int i = 0;
while (i<max && elapsed()<10)
{
formatter.Serialize(fos, d);
fos.Flush();
FlushFileBuffers(fos.Handle); // Forces the OS to flush
i++;
}
double t =elapsed();
long f = fos.Length;
Console.WriteLine(
n +"\t"+
i + "\t"+
f / i +"\t"+
i / t +"\t"+
n * i / t);
}
}
}
开发者ID:bamboo,项目名称:Bamboo.Prevalence,代码行数:39,代码来源:SerializationThroughput.cs
示例18: Main
static void Main()
{
Intro();
Integer[] numbers = new Integer[ARRAY_SIZE];
for (int i = 0; i < ARRAY_SIZE; i++ )
{
Integer number = new Integer(i);
numbers[i] = number;
}
for (int i = 0; i < ARRAY_SIZE; i++ )
{
int number = numbers[i].GetValue();
Console.WriteLine("The value of Integer[{0}] is {1}.", i, number);
}
End();
}
开发者ID:kacecode,项目名称:SchoolWork,代码行数:21,代码来源:Program.cs
示例19: Ship
public static CUrl Ship(Integer ShipID) { return null; }
开发者ID:TheJP,项目名称:Stne,代码行数:1,代码来源:CUrlBuilder.cs
示例20: Script
public static CUrl Script(Integer ScriptID) { return null; }
开发者ID:TheJP,项目名称:Stne,代码行数:1,代码来源:CUrlBuilder.cs
注:本文中的Integer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论