下面这行代码在silverlight的Chrome和Firefox下抛出了一个ArgumentNullException。我正在使用HttpWebRequest将文件发送到服务器。我在文档中看不到任何原因,为什么代码会抛出这个异常。//note that asyncResult is not null
response = (HttpWebResponse)request.EndGetResponse(asyncResult);<EndGetResponse&g
现在假设这个方法被传递了一个null参数,这是一个致命的错误,并且应该抛出一个异常。编写这样的代码是否值得(请记住,这只是一个微不足道的例子):{ throw new ArgumentNullException;}
或者当它调用x.doSomething()时,仅仅依靠它抛出NullException对我来说是安全的吗?我是应该立即抛出异常,还是等到需
("itemList"); throw new ArgumentNullException("indexToFind");为null,则抛出itemList。当在上面的方法上运行我的unittest时,我期望ArgumentNullException类型的异常,因为itemList是null。但是,测试结果是假的,因为没有抛出任何异常。
WebRequest.Create( new Uri("https://myurl.com/myfile" ) );...
{System.ArgumentNullException ---> System.ArgumentNullException: Value cannot be null<EndGetR