Answers for "catch exception c# when"

C#
1

test how catch exception c#

[TestMethod]
[ExpectedException(typeof(ArgumentException),
    "A userId of null was inappropriately allowed.")]
public void NullUserIdInConstructor()
{
   LogonInfo logonInfo = new LogonInfo(null, "P@ss0word");
}
Posted by: Guest on March-02-2020
0

c# try catch with error message

try
{
	//...some code
}
catch(Exception ex)
{
	MessageBox.Show(ex.Message);
}
Posted by: Guest on January-11-2022

C# Answers by Framework

Browse Popular Code Answers by Language