⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 program.cs

📁 C#2.0宝典源码,C#经典书籍,很多例子
💻 CS
字号:
using System;
using System.Collections.Generic;
using System.Text;

namespace Example6_4 {
    class Program {
        static void Main(string[] args) {
            int[] myArray = new int[4] { 1, 2, 3, 4 };

            try {
                myArray[5] = 5;
            } catch (IndexOutOfRangeException e) {
                Console.WriteLine("出现了IndexOutOfRangeException异常,请检查代码,确认有无数组索引超出范围的情况!");

                //输出异常变量e的详细信息。
                Console.WriteLine(e.Data.ToString());
                Console.WriteLine(e.HelpLink);
                Console.WriteLine(e.InnerException == null ? "" : e.InnerException.ToString());
                Console.WriteLine(e.Message);
                Console.WriteLine(e.Source);
                Console.WriteLine(e.StackTrace);
                Console.WriteLine(e.TargetSite.ToString());
            }

            Console.ReadLine();
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -