-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathThrowExtensions.cs
More file actions
46 lines (41 loc) · 2.49 KB
/
ThrowExtensions.cs
File metadata and controls
46 lines (41 loc) · 2.49 KB
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
44
45
46
using System;
using System.Runtime.CompilerServices;
using Platform.Exceptions.ExtensionRoots;
#pragma warning disable IDE0060 // Remove unused parameter
namespace Platform.Exceptions
{
/// <summary>
/// <para>Provides a set of extension methods for <see cref="ThrowExtensionRoot"/> objects.</para>
/// </summary>
public static class ThrowExtensions
{
/// <summary>
/// <para>Throws a new <see cref="System.NotSupportedException"/>.</para>
/// </summary>
/// <param name="root"><para>The extension root to which this method is bound.</para></param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void NotSupportedException(this ThrowExtensionRoot root) => throw new NotSupportedException();
/// <summary>
/// <para>Throws a new <see cref="System.NotSupportedException"/>, while returning a value of <typeparamref name="TReturn"/> type.</para>
/// </summary>
/// <typeparam name="TReturn"><para>The type of returned value.</para></typeparam>
/// <param name="root"><para>The extension root to which this method is bound.</para></param>
/// <returns><para>A value of <typeparamref name="TReturn"/> type.</para></returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TReturn NotSupportedExceptionAndReturn<TReturn>(this ThrowExtensionRoot root) => throw new NotSupportedException();
/// <summary>
/// <para>Throws a new <see cref="System.NotImplementedException"/>.</para>
/// </summary>
/// <param name="root"><para>The extension root to which this method is bound.</para></param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void NotImplementedException(this ThrowExtensionRoot root) => throw new NotImplementedException();
/// <summary>
/// <para>Throws a new <see cref="System.NotImplementedException"/>, while returning a value of <typeparamref name="TReturn"/> type.</para>
/// </summary>
/// <typeparam name="TReturn"><para>The type of returned value.</para></typeparam>
/// <param name="root"><para>The extension root to which this method is bound.</para></param>
/// <returns><para>A value of <typeparamref name="TReturn"/> type.</para></returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TReturn NotImplementedExceptionAndReturn<TReturn>(this ThrowExtensionRoot root) => throw new NotImplementedException();
}
}