我正在学习C#,捕捉异常时遇到这样一个类InvariantException,问问高手,这个是系统的类么?我好像报错,说是找不到命名空间?
解决方案 »
- 文件目录
- c#更改combobox的外观
- 关于多线程的同步问题
- c#中如何调用vc++写的动态链接库,请高手指点
- 找方法!service怎样定时执行一个程序 ?高手啊,不吝赐教吧
- 怎么在c#中求时间差
- 问一声:visual c#(WinForm)中的DataGrid在绑定DateSet时能否动态改变显示值?
- 有难度的问题?用程序循环读取DataGrid的值的问题?(内附代码)
- DataGrid的CurrentCellChanged事件
- C#中使用ADO.NET连接数据库,为何不能引用ADO?也就是using System.Data.ADO死活无法编译,为何?
- 关于AxWebBrowser问题集欢迎支持浏览器开发
- 2005的webBrowser控件浏览网页,为什么跳出的窗口是ie的窗口?
using System;namespace testcmp
{
/// <summary>
/// MyStack の概要の説明です。
/// </summary>
public class MyStack
{
public MyStack()
{
stack = new string[100];
nextIndex = 0;
}
public string Pop(){
return stack[--nextIndex];
}
public void Delete(int n){
nextIndex -= n;
}
public void Push(string astring){
stack[nextIndex++] = astring;
}
public string Top(){
return stack[nextIndex-1];
}
private int nextIndex;
private string[] stack;
public void CheckInvariant(){
if (!(nextIndex >=0 && nextIndex < stack.Length )){
throw new InvariantException(
"nextIndex out of the range:" + nextIndex +
"for stack length" + stack.Length
);
}
}
}
}
因为我在学NUnit,所以写了一个小类,做作测试的。
谢谢高手指教阿
[This documentation is preliminary and subject to change.]The InvalidValueException class represents a non-fatal E_invalidValue runtime error that occurs during the execution of a UDDI method.The InvalidValueException class is derived from the Microsoft.Uddi.UddiException class.
Could you say in detail and in chinese maybe better for me !
不过能告诉我,它们之间有什么区别么?它是个系统类么?
就是说,这是个自定义的类咯?如果功能上也只是抛出异常信息的话,就没有必要重新定义,在这里花力气了,对么?
可以让它抛出“特定的”“明确的”异常信息,所以不能说是白花力气。