File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change
1
+ // Copyright (c) Microsoft Corporation. All rights reserved.
2
+ // Licensed under the MIT license.
3
+
4
+ using System ;
5
+
6
+ namespace Microsoft . OpenApi
7
+ {
8
+ /// <summary>
9
+ /// Utilities methods
10
+ /// </summary>
11
+ public static class Utils
12
+ {
13
+ /// <summary>
14
+ /// Check whether the input argument value is null or not.
15
+ /// </summary>
16
+ /// <typeparam name="T">The input value type.</typeparam>
17
+ /// <param name="value">The input value.</param>
18
+ /// <param name="parameterName">The input parameter name.</param>
19
+ /// <returns>The input value.</returns>
20
+ internal static T CheckArgumentNull < T > ( T value , string parameterName ) where T : class
21
+ {
22
+ return value ?? throw new ArgumentNullException ( parameterName , $ "Value cannot be null: { parameterName } ") ;
23
+ }
24
+
25
+ /// <summary>
26
+ /// Check whether the input string value is null or empty.
27
+ /// </summary>
28
+ /// <param name="value">The input string value.</param>
29
+ /// <param name="parameterName">The input parameter name.</param>
30
+ /// <returns>The input value.</returns>
31
+ internal static string CheckArgumentNullOrEmpty ( string value , string parameterName )
32
+ {
33
+ return string . IsNullOrEmpty ( value ) ? throw new ArgumentNullException ( parameterName , $ "Value cannot be null or empty: { parameterName } ") : value ;
34
+ }
35
+ }
36
+ }
You can’t perform that action at this time.
0 commit comments