C# Dynamic Keyword exception handling

Posted by user972255 on Stack Overflow See other posts from Stack Overflow or by user972255
Published on 2012-09-15T03:24:26Z Indexed on 2012/09/15 3:37 UTC
Read the original article Hit count: 203

Filed under:
|

The below code throws an exception when executing this line (i.e. something.Add(name)).

I want to catch the actual exception when executing this. I mean I don't want to use catch(Exception ex) instead of that I want to know what is the correct exception thrown here.

try
{
  dynamic name= "test";
  var something = new List<decimal>();
  something.Add(name);
}
catch(Exception ex)
{
  throw ex;
}

Thanks in advance.

© Stack Overflow or respective owner

Related posts about exception

Related posts about dynamic