Specified cast is not valid #3

前端 未结 1 419
长发绾君心
长发绾君心 2021-01-26 23:09

I have this issue where I am receiving \"Specified cast is not valid\" no errors in the Error list inside Visual Studio. Could this error becoming from my Access Database?

1条回答
  •  情歌与酒
    2021-01-26 23:55

    Your conjecture is almost certainly correct.

    A boxed value type may only be unboxed to the type it actually is. If you have a long in there, you can't unbox it to short? directly. You have to unbox it to long (or long?) first, and then convert it to short?.

    This is a pretty frequently asked question. See my article on the subject for a detailed explanation.

    http://ericlippert.com/2009/03/03/representation-and-identity/

    0 讨论(0)
提交回复
热议问题