csharp System.ComponentModel.InvalidEnumArgumentException类(方法)实例源码

下面列出了csharp System.ComponentModel.InvalidEnumArgumentException 类(方法)源码代码实例,从而了解它的用法。

作者:.NET开发    项目:System.ComponentMode   
try 
{
// Attempts to pass an invalid enum value (MessageBoxButtons) to the Show method
    MessageBoxButtons myButton= (MessageBoxButtons) 123;
    MessageBox.Show("This is a message","This is the Caption",myButton);
}
catch(InvalidEnumArgumentException invE) 
{
    Console.WriteLine(invE.Message);
    Console.WriteLine(invE.ParamName);
    Console.WriteLine(invE.StackTrace);
    Console.WriteLine(invE.Source);
}


问题


面经


文章

微信
公众号

扫码关注公众号