Skip to content

Commit

Permalink
Standardise null-or-empty checks, resolves deprecated IsNullOrEmpty
Browse files Browse the repository at this point in the history
… helper method

castleproject#612 - Updating Windsor to support Castle.Core@5.0.0 and modern TFMs
  • Loading branch information
Jevonius committed May 14, 2022
1 parent c6749e0 commit adc59db
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -786,11 +786,11 @@ public ComponentRegistration<TService> NamedAutomatically(String name)
/// <param name = "actions"> A set of actions to be executed right after the component is created and before it's returned from the container. </param>
public ComponentRegistration<TService> OnCreate(params Action<TService>[] actions)
{
if (actions.IsNullOrEmpty())
if (actions != null && actions.Length != 0)
{
return this;
return OnCreate(actions.ConvertAll(a => new LifecycleActionDelegate<TService>((_, o) => a(o))));
}
return OnCreate(actions.ConvertAll(a => new LifecycleActionDelegate<TService>((_, o) => a(o))));
return this;
}

/// <summary>
Expand All @@ -813,16 +813,16 @@ public ComponentRegistration<TService> OnCreate(params LifecycleActionDelegate<T
/// <param name = "actions"> A set of actions to be executed right after the component is created and before it's returned from the container. </param>
public ComponentRegistration<TService> OnDestroy(params Action<TService>[] actions)
{
if (actions.IsNullOrEmpty())
if (actions != null && actions.Length != 0)
{
return this;
return OnDestroy(actions.ConvertAll(a => new LifecycleActionDelegate<TService>((_, o) => a(o))));
}
return OnDestroy(actions.ConvertAll(a => new LifecycleActionDelegate<TService>((_, o) => a(o))));
return this;
}

/// <summary>
/// Stores a set of <see cref = "LifecycleActionDelegate{T}" /> which will be invoked when the component is destroyed which means when it's released or it's lifetime scope ends. Notice that usage of this
/// method will cause instsances of the component to be tracked, even if they wouldn't be otherwise.
/// method will cause instances of the component to be tracked, even if they wouldn't be otherwise.
/// </summary>
/// <param name = "actions"> A set of actions to be executed when the component is destroyed. </param>
public ComponentRegistration<TService> OnDestroy(params LifecycleActionDelegate<TService>[] actions)
Expand Down

0 comments on commit adc59db

Please sign in to comment.