-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUserDefineException.cs
More file actions
43 lines (39 loc) · 909 Bytes
/
UserDefineException.cs
File metadata and controls
43 lines (39 loc) · 909 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
using System;
using System.IO;
using System.Reflection;
using System.Runtime.Serialization.Formatters.Binary;
/*. Serialization :
Is the process of converting object into byte stream so
that it can be saved to memory file or database.
the reverse process of serialization is called Deserilization
*/
namespace ConsoleApp76
{
public class Test
{
private static void Validate(int age)
{
if (age < 18)
{
throw new InvalidAgeException("Hello Wrong Test");
}
}
public static void Main(string[] args)
{
try
{
Validate(12);
}
catch (InvalidAgeException e)
{
Console.WriteLine(e.ToString());
}
}
}
internal class InvalidAgeException : Exception
{
public InvalidAgeException(string helloWrongTest):base(helloWrongTest)
{
}
}
}