How to create a custom exception message in C#
Sample from http://www.blackwasp.co.uk/CSharpThrowingExceptions.aspx
using System;
namespace BlackWasp
{
class TestApp
{
static void Main(string[] args)
{
// Check that a parameter was provided
if (args.Length == 0)
{
throw new ArgumentException("A start-up parameter is required.");
}
Console.WriteLine("{0} argument(s) provided", args.Length);
}
}
}
No comments:
Post a Comment