本文整理汇总了C#中IUserInterface.WriteLine方法的典型用法代码示例。如果您正苦于以下问题:C# IUserInterface.WriteLine方法的具体用法?C# IUserInterface.WriteLine怎么用?C# IUserInterface.WriteLine使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IUserInterface
的用法示例。
在下文中一共展示了IUserInterface.WriteLine方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Display
public void Display(IUserInterface userInterface, IServiceResult serviceResult)
{
if (userInterface == null)
{
throw new ArgumentNullException("userInterface");
}
if (serviceResult == null)
{
return;
}
if (serviceResult.Status == ServiceResultType.NoResult)
{
return;
}
if (string.IsNullOrWhiteSpace(serviceResult.Message))
{
return;
}
if (serviceResult.InnerResult != null)
{
this.Display(userInterface, serviceResult.InnerResult);
}
string resultTypeLabel = Resources.ServiceResultVisualizer.ResourceManager.GetString("ServiceResultType" + serviceResult.Status);
userInterface.WriteLine(resultTypeLabel + ": " + serviceResult.Message);
if (!string.IsNullOrWhiteSpace(serviceResult.ResultArtefact))
{
userInterface.WriteLine(Resources.ServiceResultVisualizer.ReturnValue + ": " + serviceResult.ResultArtefact);
}
}
示例2: TakeMatrixDimension
private static int TakeMatrixDimension(IUserInterface userInterface)
{
userInterface.WriteLine("Enter a positive number ");
string input = userInterface.ReadLine();
int number;
bool isParsed = int.TryParse(input, out number);
while (!isParsed || number < 0 || number > 100)
{
userInterface.WriteLine("You haven't entered a correct positive number");
input = userInterface.ReadLine();
isParsed = int.TryParse(input, out number);
}
return number;
}
示例3: PrintMatrix
private static void PrintMatrix(int[,] matrix, IUserInterface userInterface)
{
int rows = matrix.GetLength(0);
int cols = matrix.GetLength(1);
for (int row = 0; row < rows; row++)
{
for (int col = 0; col < cols; col++)
{
userInterface.Write("{0,3}", matrix[row, col]);
}
userInterface.WriteLine();
}
}