Implementing Structured Exception Handling
n Implement the GetString Method
n
n
n Create and Throw a New Object of Type IndexOutOfRangeException
n
n
n Exceptions Caught by the Caller Using a try/catch/finally Statement
n Structured Exception Handling Replaces HRESULT-Based Error Handling in COM
public string GetString(int index) {...}
if((index < 0) || (index >= stringSet.Length)) {
throw new IndexOutOfRangeException();
}
return stringSet[index];