-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from I-RzR-I/feature/AddIfNullOrXExtensions
Adjust/clean up code execution. Add new extens
- Loading branch information
Showing
22 changed files
with
732 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
src/DomainCommonExtensions/CommonExtensions/TypeParam/TypeParamActionExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
// *********************************************************************** | ||
// Assembly : RzR.Shared.Extensions.DomainCommonExtensions | ||
// Author : RzR | ||
// Created On : 2024-02-13 19:42 | ||
// | ||
// Last Modified By : RzR | ||
// Last Modified On : 2024-02-13 20:02 | ||
// *********************************************************************** | ||
// <copyright file="TypeParamActionExtensions.cs" company=""> | ||
// Copyright (c) RzR. All rights reserved. | ||
// </copyright> | ||
// | ||
// <summary> | ||
// </summary> | ||
// *********************************************************************** | ||
|
||
#region U S A G E S | ||
|
||
using System; | ||
|
||
#endregion | ||
|
||
namespace DomainCommonExtensions.CommonExtensions.TypeParam | ||
{ | ||
/// ------------------------------------------------------------------------------------------------- | ||
/// <content> | ||
/// T type extensions. | ||
/// </content> | ||
/// ================================================================================================= | ||
public static partial class TExtensions | ||
{ | ||
/// ------------------------------------------------------------------------------------------------- | ||
/// <summary> | ||
/// Return data if not null. | ||
/// </summary> | ||
/// <exception cref="ArgumentNullException"> | ||
/// Thrown when one or more required arguments are null. | ||
/// </exception> | ||
/// <typeparam name="TInput">Input type.</typeparam> | ||
/// <param name="source">Source data.</param> | ||
/// <param name="action">Action.</param> | ||
/// ================================================================================================= | ||
public static void IfNotNull<TInput>(this TInput source, Action<TInput> action) | ||
{ | ||
if (action.IsNull()) | ||
throw new ArgumentNullException(nameof(action)); | ||
|
||
if (source.IsNull()) | ||
return; | ||
|
||
action(source); | ||
} | ||
|
||
/// ------------------------------------------------------------------------------------------------- | ||
/// <summary> | ||
/// Return data if null. | ||
/// </summary> | ||
/// <exception cref="ArgumentNullException"> | ||
/// Thrown when one or more required arguments are null. | ||
/// </exception> | ||
/// <typeparam name="TInput">Input type.</typeparam> | ||
/// <param name="source">Source data.</param> | ||
/// <param name="action">Action.</param> | ||
/// ================================================================================================= | ||
public static void IfNull<TInput>(this TInput source, Action<TInput> action) | ||
{ | ||
if (action.IsNull()) | ||
throw new ArgumentNullException(nameof(action)); | ||
|
||
if (source.IsNull()) | ||
action(source); | ||
} | ||
} | ||
} |
Oops, something went wrong.