.


:




:

































 

 

 

 


. .




.

nums[0]: 0

nums[1]: 1 v

nums[2]: 2

nums[3]: 3

: System.IndexOutOfRangeException:

.

ExcTest.genException() <_ >: 15 UseExcept.Main() <_ >: 2 9 StackTrace: ExcTest.genException() <_ >: 15

UseExcept.Main() <_ >: 2 9 Message: .

TargetSite: Void genException ()

.

Public Exception ()

public Exception(string )

public Exception(string , Exception _) protected Exception(System.Runtime.Serialization.Serializationlnfo , System.Runtime.Serialization.StreamingContext )

. , Message, . . , , _ , , . ( , InnerException, Exception.) , , .

, Exception Serializationlnfo StreamingContext System. Runtime.Serialization.

System , . SystemException, CLR . . 13.1 .

13.1. , System

 

 

 

ArrayTypeMismatchException

 

 

DivideByZeroException

 

 

IndexOutOfRangeException

 

 

InvalidCastException

 

 

OutOfMemoryException

 

. , , , new

 

OverflowException

 

 

NullReferenceException

 

, .. ,

 

, . 13.1, , NullReferenceException. , , . , . , , , , null. , . , NullReferenceException.

// NullReferenceException.

Using System;

class X { int x;

public X(int a) { x = a;

}

public int Add(X o) { return x + o.x;

}

}

// // NullReferenceException. class NREDemo {

static void Main() {

X p = new X(10);

X q = null; // q int val;

try {

val = p.Add(q); // } catch (NullReferenceException) {

Console.WriteLine(" NullReferenceException!");

Console.WriteLine(" ...\n");

// , q = new X(9); val = p.Add(q);

}

Console.WriteLine(" val {0}", val);

}

}





:


: 2016-12-03; !; : 548 |


:

:

: , .
==> ...

776 - | 739 -


© 2015-2024 lektsii.org - -

: 0.013 .