-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
V9.0.0/task based sceanario relocation #95
Merged
Merged
Changes from 11 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
cdda21b
:bug: fixed a bug that mistakenly applied key instead of key-value wh…
gimlichael 87e60bf
:sparkles: extended with new method; RawEnclose
gimlichael ecc8a3e
:recycle: moved internal ResolveDelegateInfo to public extension meth…
gimlichael 2aed276
:building_construction: move SafeInvokeAsync to specialized assembly …
gimlichael bca8c62
:building_construction: move Task-based Action and Func factories to …
gimlichael a2e4fbc
:building_construction: related to 2aed276
gimlichael ed49cef
:recycle: reduced footprint in core assembly
gimlichael 85b2456
:heavy_plus_sign: added reference to Cuemon.Diagnostics
gimlichael e0beb79
:white_check_mark: updated to reflect refactoring/restructuring
gimlichael 40ac494
:arrow_up: bumbed dependency
gimlichael f1799f8
:recycle: organic split that is true to vision
gimlichael 92c163b
:recycle: renamed for consistency to Async prefix
gimlichael File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using System; | ||
using System.Reflection; | ||
|
||
namespace Cuemon | ||
{ | ||
/// <summary> | ||
/// Extension methods for the <see cref="Delegate"/> hidden behind the <see cref="IDecorator{T}"/> interface. | ||
/// </summary> | ||
/// <seealso cref="IDecorator{T}"/> | ||
/// <seealso cref="Decorator{T}"/> | ||
public static class DelegateDecoratorExtensions | ||
{ | ||
/// <summary> | ||
/// Resolves the <see cref="MethodInfo"/> of the specified <paramref name="original"/> delegate or the enclosed <see cref="Delegate"/> of the <paramref name="decorator"/>. | ||
/// </summary> | ||
/// <param name="decorator">The <see cref="IDecorator{T}"/> to extend.</param> | ||
/// <param name="original">The original delegate to resolve the method information from.</param> | ||
/// <returns>The <see cref="MethodInfo"/> of the specified <paramref name="original"/> delegate or the enclosed <see cref="Delegate"/> of the <paramref name="decorator"/>; otherwise, <c>null</c> if both are <c>null</c>.</returns> | ||
public static MethodInfo ResolveDelegateInfo(this IDecorator<Delegate> decorator, Delegate original) | ||
{ | ||
var wrapper = decorator?.Inner; | ||
if (original != null) { return original.GetMethodInfo(); } | ||
if (wrapper != null) { return wrapper.GetMethodInfo(); } | ||
return null; | ||
} | ||
} | ||
} |
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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Consider simplifying the method implementation.
While the current implementation is correct, it could be simplified to improve readability and reduce the number of lines of code.
Consider refactoring the method as follows:
This refactored version uses the null-coalescing operator to achieve the same logic in a more concise manner. It first attempts to get the MethodInfo from the original delegate, and if that's null, it tries to get it from the decorator's inner delegate.
📝 Committable suggestion