本文整理汇总了C#中System.Int64.GetLength方法的典型用法代码示例。如果您正苦于以下问题:C# Int64.GetLength方法的具体用法?C# Int64.GetLength怎么用?C# Int64.GetLength使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Int64
的用法示例。
在下文中一共展示了Int64.GetLength方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WriteExtended
public void WriteExtended(string key, Int64[, ,] array3D)
{
if (writer == null)
throw new FileEE("無効なストリームです");
if (array3D == null)
throw new FileEE("無効な配列が渡されました");
int countX = 0;
int length0 = array3D.GetLength(0);
int length1 = array3D.GetLength(1);
int length2 = array3D.GetLength(2);
int[] countY = new int[length0];
int[,] countZ = new int[length0, length1];
for (int x = 0; x < length0; x++)
{
for (int y = 0; y < length1; y++)
{
for (int z = 0; z < length2; z++)
{
if (array3D[x, y, z] != 0)
{
countX = x + 1;
countY[x] = y + 1;
countZ[x, y] = z + 1;
}
}
}
}
if (countX == 0)
return;
writer.WriteLine(key);
for (int x = 0; x < countX; x++)
{
writer.WriteLine(x.ToString() + "{");
if (countY[x] == 0)
{
writer.WriteLine("}");
continue;
}
for (int y = 0; y < countY[x]; y++)
{
StringBuilder builder = new StringBuilder("");
if (countZ[x, y] == 0)
{
writer.WriteLine("");
continue;
}
for (int z = 0; z < countZ[x, y]; z++)
{
builder.Append(array3D[x, y, z].ToString());
if (z != countZ[x, y] - 1)
builder.Append(",");
}
writer.WriteLine(builder.ToString());
}
writer.WriteLine("}");
}
writer.WriteLine(FINISHER);
}
示例2: runTest
public Boolean runTest()
{
Console.Error.WriteLine(s_strTFPath + " " + s_strTFName + " , for " + s_strClassMethod + " , Source ver " + s_strDtTmVer);
int iCountErrors = 0;
int iCountTestcases = 0;
String strLoc = "Loc_000oo";
String strBaseLoc;
short[] in2Arr = new Int16[10];
int[] in4Arr = new Int32[5];
long[] in8Arr = new Int64[0];
String[] strArr = new String[6];
Boolean[] boArr = new Boolean[3];
Double[] dblArr = new Double[2];
Single[] snglArr = new Single[32000];
Char[] chArr = new Char[10000];
int rank;
try {
LABEL_860_GENERAL:
do
{
strLoc = "Loc_819yt";
rank = -1;
in2Arr = new Int16[5];
iCountTestcases++;
try {
in2Arr.GetLength(rank);
iCountErrors++;
Console.WriteLine( s_strTFAbbrev+ "Err_499ws! , GetLength=="+in2Arr.Length);
} catch (IndexOutOfRangeException ioorExc) {}
catch (Exception exc) {
iCountErrors++;
Console.WriteLine( s_strTFAbbrev+ "Err_758! exc=="+exc);
}
strLoc = "Loc_819ee";
rank = 1;
in2Arr = new Int16[5];
iCountTestcases++;
try {
in2Arr.GetLength(rank);
iCountErrors++;
Console.WriteLine( s_strTFAbbrev+ "Err_500ws! , GetLength=="+in2Arr.Length);
} catch (IndexOutOfRangeException ioorExc) {}
catch (Exception exc) {
iCountErrors++;
Console.WriteLine( s_strTFAbbrev+ "Err_750! exc=="+exc);
}
strLoc = "Loc_482wu";
rank = 0;
in2Arr = new Int16[10];
iCountTestcases++;
if(in2Arr.GetLength(rank) != 10)
{
iCountErrors++;
Console.WriteLine( s_strTFAbbrev+ "Err_481ua! , GetLength=="+in2Arr.Length);
}
strLoc = "Loc_471ay";
in4Arr = new Int32[5];
iCountTestcases++;
if(in4Arr.GetLength(rank) != 5)
{
iCountErrors++;
Console.WriteLine( s_strTFAbbrev+ "Err_29qaq! , GetLength=="+in4Arr.Length);
}
strLoc = "Loc_982uq";
in8Arr = new Int64[0];
iCountTestcases++;
if(in8Arr.GetLength(rank) != 0)
{
iCountErrors++;
Console.WriteLine( s_strTFAbbrev+ "Err_237sy! , GetLength=="+in8Arr.Length);
}
strLoc = "Loc_172ms";
boArr = new Boolean[3];
iCountTestcases++;
if(boArr.GetLength(rank) != 3)
{
iCountErrors++;
Console.WriteLine( s_strTFAbbrev+ "Err_382! , GetLength=="+boArr.Length);
}
strLoc = "Loc_49su";
dblArr = new Double[2];
iCountTestcases++;
if(dblArr.GetLength(rank) != 2)
{
iCountErrors++;
Console.WriteLine( s_strTFAbbrev+ "Err_200su! , GetLength=="+dblArr.Length);
}
strLoc = "Loc_371su";
snglArr = new Single[32000];
iCountTestcases++;
if(snglArr.GetLength(rank) != 32000)
{
iCountErrors++;
Console.WriteLine( s_strTFAbbrev+ "Err_319aw! , GetLength=="+snglArr.Length);
}
strLoc = "Loc_129wi";
strArr = new String[5];
strArr[2] = null;
iCountTestcases++;
if(strArr.GetLength(rank) != 5)
//.........这里部分代码省略.........
示例3: IsEqual
public static bool IsEqual(this Int16[,] a, Int64[][] b, Int64 atol = 0, Double rtol = 0)
{
if (a == null && b == null)
return true;
if (a == null ^ b == null)
return false;
int[] la = a.GetLength(true);
int[] lb = b.GetLength(true);
if (la.Length != lb.Length)
return false;
for (int i = 0; i < la.Length; i++)
if (la[i] != lb[i])
return false;
if (rtol > 0)
{
for (int i = 0; i < b.Length; i++)
for (int j = 0; j < b[i].Length; j++)
{
var A = a[i, j];
var B = b[i][j];
if (A == B)
continue;
var C = A;
var D = B;
var delta = Math.Abs(C - D);
if (C == 0)
{
if (delta <= rtol)
continue;
}
else if (D == 0)
{
if (delta <= rtol)
continue;
}
if (delta <= Math.Abs(C) * rtol)
continue;
return false;
}
}
else if (atol > 0)
{
for (int i = 0; i < b.Length; i++)
for (int j = 0; j < b[i].Length; j++)
{
var A = a[i, j];
var B = b[i][j];
if (A == B)
continue;
var C = A;
var D = B;
if (Math.Abs(C - D) <= atol)
continue;
return false;
}
}
else
{
for (int i = 0; i < b.Length; i++)
for (int j = 0; j < b[i].Length; j++)
{
var A = a[i, j];
var B = b[i][j];
if (A != B)
return false;
}
}
return true;
}
示例4: writeData
private void writeData(Int64[, ,] array)
{
int countZero = 0;//0については0が連続する数を記憶する。その他はそのまま記憶する。
int countAllZero = 0;//列の要素が全て0である列の連続する数を記憶する。列の要素に一つでも非0があるなら通常の記憶方式。
int countAllZero2D = 0;//行列の要素が全て0である行列の・・・
int length0 = array.GetLength(0);
int length1 = array.GetLength(1);
int length2 = array.GetLength(2);
writer.Write(length0);
writer.Write(length1);
writer.Write(length2);
for(int x = 0; x < length0; x++)
{
for(int y = 0; y < length1; y++)
{
for(int z = 0; z < length2; z++)
{
if (array[x,y,z] == 0)
countZero++;
else
{
if (countAllZero2D > 0)
{
writer.Write(Ebdb.ZeroA2);
this.m_WriteInt(countAllZero2D);
countAllZero2D = 0;
}
if (countAllZero > 0)
{
writer.Write(Ebdb.ZeroA1);
this.m_WriteInt(countAllZero);
countAllZero = 0;
}
if (countZero > 0)
{
writer.Write(Ebdb.Zero);
this.m_WriteInt(countZero);
countZero = 0;
}
this.m_WriteInt(array[x,y,z]);
}
}
if (countZero == length2)
countAllZero++;
else
writer.Write(Ebdb.EoA1);
countZero = 0;
}
if (countAllZero == length1)
countAllZero2D++;
else
writer.Write(Ebdb.EoA2);
countAllZero = 0;
}
writer.Write(Ebdb.EoD);
}
示例5: CheckPartnerLocationChange
//.........这里部分代码省略.........
{
// AAddressAddedOrChangedPromotionDT was passed in, holding parameters for the LocationKey we are looking at
AddressAddedOrChangedRow = (PartnerAddressAggregateTDSAddressAddedOrChangedPromotionRow)AddressAddedOrChangedPromotionDV[0].Row;
if (AddressAddedOrChangedRow.UserAnswer == "CHANGE-NONE")
{
// TLogging.LogAtLevel(9, "CheckPartnerLocationChange: AAddressAddedOrChangedPromotionDT tells me to UPDATE NONE of the Persons with the changes that were made to the PartnerLocation.");
// No processing necessary!
AddressAddedOrChangedRow.AnswerProcessedClientSide = true;
AddressAddedOrChangedRow.AcceptChanges();
ReturnValue = true;
}
else if (AddressAddedOrChangedRow.UserAnswer.StartsWith("CHANGE-SOME"))
{
// TLogging.LogAtLevel(9, "CheckPartnerLocationChange: AAddressAddedOrChangedPromotionDT tells me to UPDATE SOME Persons with the changes that were made to the PartnerLocation.");
AUpdatePartnerLocations = true;
// Parse the UserAnswer. It's format is 'CHANGESOME:PartnerKey1,SiteKey1,LocationKey1;PartnerKey2,SiteKey2,LocationKey2;PartnerKeyN,SiteKeyN,LocationKeyN'
ChangeSomeArray = AddressAddedOrChangedRow.UserAnswer.Split(":,;".ToCharArray());
/*
* Build the AUpdatePartnerLocationOtherPersons array from the UserAnswer
* to signal to calling procedure that the changes that were made to the
* PartnerLocation that we are processing should be
* taken over to all the Person's PartnerLocations contained in the Array.
*/
AUpdatePartnerLocationOtherPersons = new Int64[Convert.ToInt32((ChangeSomeArray.Length - 1) / 3.0), 3];
// Counter: ' 1': don't include 'CHANGESOME' array entry, '/ 3' each entry consists of three strings:
Counter = 1;
Counter2 = 0;
while (Counter < AUpdatePartnerLocationOtherPersons.GetLength(0) * 3)
{
// store PartnerKey
AUpdatePartnerLocationOtherPersons[Counter2, 0] = Convert.ToInt64(ChangeSomeArray[Counter]);
// TLogging.LogAtLevel(9, "CheckPartnerLocationChange: PartnerKey[" + Counter2.ToString() + "]: " +
// AUpdatePartnerLocationOtherPersons[Counter2, 0].ToString());
// store SiteKey
AUpdatePartnerLocationOtherPersons[Counter2, 1] = Convert.ToInt32(ChangeSomeArray[Counter + 1]);
// TLogging.LogAtLevel(9, "CheckPartnerLocationChange: SiteKey[" + Counter2.ToString() + "]: " +
// AUpdatePartnerLocationOtherPersons[Counter2, 1].ToString());
// store LocationKey
AUpdatePartnerLocationOtherPersons[Counter2, 2] = Convert.ToInt32(ChangeSomeArray[Counter + 2]);
// TLogging.LogAtLevel(9, "CheckPartnerLocationChange: LocationKey[" + Counter2.ToString() + "]: " +
// AUpdatePartnerLocationOtherPersons[Counter2, 2].ToString());
// position Counter to next 'record' of PartnerKey, SiteKey and LocationKey
Counter = Counter + 3;
Counter2 = Counter2 + 1;
}
AddressAddedOrChangedRow.AnswerProcessedClientSide = true;
AddressAddedOrChangedRow.AcceptChanges();
ReturnValue = true;
}
else if (AddressAddedOrChangedRow.UserAnswer == "CHANGE-ALL")
{
// TLogging.LogAtLevel(9, "CheckPartnerLocationChange: AAddressAddedOrChangedPromotionDT tells me to UPDATE ALL Persons with the changes that were made to the PartnerLocation.");
AUpdatePartnerLocations = true;
/*
* Build the AUpdatePartnerLocationOtherPersons array from
* AChangePromotionParametersDT to signal to calling procedure that the