什么是System.ArgumentException

当向方法提供的参数之一无效时引发的异常。

继承

ArgumentException

详细说明

ArgumentException当调用方法并且传递的自变量中至少有一个参数不符合所调用方法的参数规范时, 将引发。 ParamName属性标识无效参数。

通常情况下, ArgumentException由公共语言运行时或其他类库引发, 并指示开发人员错误。 如果ArgumentException从代码引发, 则应确保异常的Message属性包含有意义的错误消息, 该消息描述了参数的无效参数和所需的值范围。

的主要派生类ArgumentException是ArgumentNullException和ArgumentOutOfRangeException。 应使用这些派生类ArgumentException, 而不是使用这些派生类, 但这些派生类都不是可接受的。 例如, 异常应由引发:

  • ArgumentNullException每当null传递到不接受其作为有效参数的方法时。

  • ArgumentOutOfRangeException当参数的值超出可接受值的范围时, 为;例如, 在创建DateTime期间, 值 "46" 作为月份参数传递时。

如果方法调用没有任何自变量, 或者失败不涉及自变量本身, 则InvalidOperationException应使用。

HRESULT

ArgumentException使用 COR_E_ARGUMENT 值为0x80070057 的 HRESULT。

关于异常System.ArgumentException的更多相关文章

  1. SharePoint 2013 引发类型为“System.ArgumentException”的异常。 參数名: encodedValue

    SharePoint 2013 引发类型为"System.ArgumentException"的异常. 參数名: encodedValue 具体错误信息 说明: 运行当前 Web ...

  2. 异常详细信息: System.ArgumentException: 不支持关键字: “metadata”。

    ASP.NET MVC中报的一个错误... 异常详细信息: System.ArgumentException: 不支持关键字: “metadata”. 其实这个是我修改web.config文件造成的, ...

  3. System.ArgumentException: 目标数组的长度不够。请检查 destIndex 和长度以及数组的下限

    扫码支付接口将要上线,近几天在优化系统性能.昨天把日志Helper类的日志记录改成了使用Queue<T>对象来实现异步处理.做了单元测试,并模拟多线程来测试后,发现正常.今天将站点部署到准 ...

  4. System.ArgumentException: 已添加了具有相同键的项。(An item with the same key has already been added) 在 System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add) 在 System.Web.Mvc.Js

    最近将一个项目从ASP.NET MVC 3升级至刚刚发布的ASP.NET MVC 5.1,升级后发现一个ajax请求出现了500错误,日志中记录的详细异常信息如下: System.ArgumentEx ...

  5. System.ArgumentException: 回发或回调参数无效。在配置中使用 < pages enableEventValidation="true"/>

    转载自http://blog.csdn.net/dongge825/article/details/7868151 关于在同一个页面中使用Gridview控件的时候发现气updaeting事件无法被服 ...

  6. MongoVUE1.6.9破解启动提示System.ArgumentException: 字体“Courier New”不支持样式“Regular”

    用MongoVUE,发现报错,报错信息如下: System.ArgumentException: 字体"Courier New"不支持样式"Regular". ...

  7. 异常:System.Data.EvaluateException: 未找到列[District].

    异常:System.Data.EvaluateException: 未找到列[District]. 这里存在的问题不一定是说,数据源表没有该字段.此问题在于数据库字段包含空格字符.

  8. (C# Debug)A first chance exception of type 'System.ArgumentException' occurred in System.Data.dll

    Debug 模式下运行程序的时候,Output 窗口出来个错误“A first chance exception of type 'System.ArgumentException' occurred ...

  9. 异常System.Web.HttpException (0x80004005): Server cannot set status after HTTP headers have been sent.

    在用mvc 的AuthorizeAttribute做身份验证,重写HandleUnauthorizedRequest方法,在Application_Error方法里出现异常System.Web.Htt ...

随机推荐

  1. football Alternative form of foteball

    football. Alternative form of foteball foteball(Late Middle English) football (game played with a ba ...

  2. The One day 中位数的计算

    """ 中位数是有序列表中间的数.如果列表长度是偶数,中位数则是中间两个数的平均值. 例如, [2,3,4] 的中位数是 3 [2,3] 的中位数是 (2 + 3) / ...

  3. spark-sql使用笔记

    如何使用hive的udf 可以使用spark-sql --jars /opt/hive/udf.jar,指定udf的路径 还可以在spark-default.conf里指定spark.jars /op ...

  4. feign.FeignException: status 400 reading

    feign.FeignException: status 400 reading : 请求方调用报错: 服务方被调用报错: 用fegin给redis设置缓存时报错,刚好 卡到8k这个临界点 ,就一直报 ...

  5. Java中强大的format

    Java中强大的format Java中允许我们对指定的对象进行某种格式化,从而得到我们想要的格式化样式. Format 首先介绍java.text包中的Format Foramt是一个抽象基类,其具 ...

  6. 提取线条的lines_color、lines_facet、 lines_gauss算子

    Halcon中线条提取的算子主要有: lines_color(Image : Lines : Sigma, Low, High, ExtractWidth, CompleteJunctions : ) ...

  7. http请求的几种content-type

    1. 2.二进制文件 3.form-data 数据:a=1 总结: 1.对于我自己的写的服务来说,只要是raw,接收到的都是二进制字符: 2.如果是urlencode,接收到的是拼接的字符串(和使用p ...

  8. Node: Process模块 (Features of Process)

    Process模块 (Features of Process) process is a global variable which indicates the current Node.js pro ...

  9. Node: 通过Console打印日志 (Log Message via Console)

    In normal development, we are likely to use 'console.log' for message logging, yet it's simple, we a ...

  10. reboot 示例代码

    #include <stdio.h> #define LINUX_REBOOT_CMD_RESTART 0x01234567 int main() { reboot(LINUX_REBOO ...