-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path102ThrowException.cs
More file actions
34 lines (27 loc) · 808 Bytes
/
102ThrowException.cs
File metadata and controls
34 lines (27 loc) · 808 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
using System;
namespace CSharp7Console
{
//Not available in c# 7 yet
/*
public class PersonThrowException
{
public string Name { get; }
public PersonThrowException(string name) => Name = name ?? throw new ArgumentNullException(name);
public string GetFirstName()
{
var parts = Name.Split(' ');
return (parts.Length > 0) ? parts[0] : throw new InvalidOperationException("No name!");
}
public string GetLastName() => throw new NotImplementedException();
}
*/
public class ThrowException
{
//public static int ThrowExceptionExample()
//{
// var x = 0;
// var y = 0;
// return y != 0 ? x / y : throw new DivideByZeroException();
//}
}
}