第七章 调试和错误处理
本章内容:
- IDE中的调试方法
- C#中的错误处理技术
7.1 VS和VCE中的调试
执行程序的两种方式:调试模式和非调试模式。
7.1.1 非中断(正常)模式下的调试
输出窗口:包括输出和调试两种模式。
1.输出调试信息
Debug.WriteLine() 仅在调试模式下运行
Trace.WriteLine() 还可用于发布程序
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
namespace ConsoleApplication3
{
class Program
{
static void Main(string[] args)
{
int[] testArray = { 4,7,4,2,7,3,7,8,3,9,1,9};
int[] maxValIndices;
int maxVal = Maxima(testArray, out maxValIndices);
Console.WriteLine("Maximum value{0} found at element indices:",maxVal);
foreach (int index in maxValIndices)
{