本文整理汇总了C#中Position.GetCoordinate方法的典型用法代码示例。如果您正苦于以下问题:C# Position.GetCoordinate方法的具体用法?C# Position.GetCoordinate怎么用?C# Position.GetCoordinate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Position
的用法示例。
在下文中一共展示了Position.GetCoordinate方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Position
public static void Position(Position position, bool isMessage = true)
{
if (isMessage)
Console.WriteLine(" --- Postion");
for (int i = 0; i < position.Dimention; i++)
{
Console.Write
("{0}; ", position.GetCoordinate(dimention: i));
}
Console.WriteLine();
}
示例2: CalculateSize
private Position CalculateSize()
{
Position result = new Position();
foreach(Number cell in this.Number)
{
Position coordinate = cell.Coordinate;
for (int i = 0; i < coordinate.Dimention; i++)
{
int newOrdinate
= coordinate.GetCoordinate(dimention: i);
if (newOrdinate > result.GetCoordinate(dimention: i))
{
result.SetCoordinate(
dimention: i,
newValue: newOrdinate);
}
}
}
return result;
}
示例3: GetField_IncList
private bool GetField_IncList(
ref List<int> coordinate,
Position maxPosition,
List<bool> mask)
{
for (int i = 0; i < coordinate.Count; i++)
{
if ((mask[i]) && (coordinate[i] < maxPosition.GetCoordinate(i)))
{
coordinate[i]++;
return true;
}
}
return false;
}
示例4: GetField2D
public Number[,] GetField2D(Position position, int dimention1, int dimention2)
{
Position fieldSize = new Position();
Number[] preResult = GetField
(ref fieldSize, position, dimention1, dimention2);
int length1 = fieldSize.GetCoordinate(0);
int length2 = fieldSize.GetCoordinate(1);
Number[,] result = new Number[length1, length2];
for (int i = 0, k = 0; i < length1; i++, k++)
{
for (int j = 0; j < length2; j++, k++)
{
result[i, j] = preResult[k];
}
}
return result;
}