Pos asi a la rapida, puedes hacer algo asi:
En el MSDN debe estar mejor explicado y de forma correcta.
Código (csharp) [Seleccionar]
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class classExcepciones
{
public void SiEsNegativo( int iPositivo )
{
if (iPositivo < 0)
throw new ArgumentException("Sólo se admiten números positivos");
}
public void DatoIncorrecto(string sDato)
{
if (string.IsNullOrEmpty(sDato))
throw new ArgumentException("Dato no valido - cadena vacia");
sDato = sDato.ToUpper();
for (int i = 0; i < sDato.Length; i++)
{
char cTemp = Convert.ToChar(sDato[i]);
int iAscii = (int)cTemp;
if (iAscii < 65 || iAscii > 91)
{
throw new ArgumentException("Dato no valido, solo se admiten letras de A-Z");
}
}
}
}
class Program
{
static void Main(string[] args)
{
classExcepciones cE = new classExcepciones();
try
{
cE.SiEsNegativo(1);
}
catch (Exception e)
{
Console.WriteLine(" " + e.Message);
}
try
{
cE.DatoIncorrecto("");
}
catch (Exception e)
{
Console.WriteLine(" " + e.Message);
}
Console.ReadKey();
}
}
}
En el MSDN debe estar mejor explicado y de forma correcta.