what is mean by applications exception and system exception in c# .net ? example for each

Recommended Answers

All 2 Replies

Why do all your questions sound like exam questions - that and you never comment on anything anyone writes to you.

An application exception is something you generate such as You dont have permission to do that, a system exception is something the OS generates - eg file not found

In addition to what LizR said You can create your costum exception too

ex:

public class OddNumbersException:ApplicationException
{
    public OddNumbersException()
        :base("Odd numbers not accepted"){}
}

in the Core programm you can throw and catch the new exception

for example

if( x Mod 2 != 0)
{
     throw new OddNumbersException();
}

other people could also use your exception if it is shipped within a program that you have developed , if they include it in their projects

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.