.Write a C# program that shows a constructor passing information about constructor failure to an
exception handler that occurs after a try block. The exception thrown also should contain the
arguments sent to the constructor.
i have got the following solution, but m stuck and dunno how to proceed
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
public class Test
{
public static void Main()
{
try
{
Sample e = new Sample();
}
catch( SampleException some )
{
Console.WriteLine("Exception Caught!");
}
}
}
class Sample
{
int x = 0;
public SomeException()
{
if(x == 0)
throw new SampleException();
}
}
Shankar MPosted Apr 25, 2013, 12:40 AM
Hope this link might help you a little.
http://www.c-sharpcorner.com/UploadFile/c5c6e2/exception-handling-in-C-Sharp/
VulpesPosted Apr 24, 2013, 10:17 AM
Try this code: