Class ExtensionMethods
- Namespace
- Monai.Deploy.InformaticsGateway.Common
- Assembly
- Monai.Deploy.InformaticsGateway.Common.dll
public static class ExtensionMethods
- Inheritance
-
ExtensionMethods
Methods
IsCanceledOrFaulted(Task)
Checks if a given task is faulted or cancelled.
public static bool IsCanceledOrFaulted(this Task task)
Parameters
taskTaskThe task object
Returns
- bool
True if canceled or faulted. False otherwise.
IsNullOrEmpty<T>(IEnumerable<T>)
Extension method for checking a IEnumerable collection is null or empty.
public static bool IsNullOrEmpty<T>(this IEnumerable<T> enumerable)
Parameters
enumerableIEnumerable<T>
Returns
- bool
true if null or empty; false otherwise.
Type Parameters
T
Post<TInput>(ActionBlock<TInput>, TInput, TimeSpan)
Extension for ActionBlock to delay post of an object to be processed.
public static Task<bool> Post<TInput>(this ActionBlock<TInput> actionBlock, TInput input, TimeSpan delay)
Parameters
actionBlockActionBlock<TInput>Instance of
ActionBlockinputTInputObject to be posted
delayTimeSpanTime to wait before posting
Returns
Type Parameters
TInputType of object to be post to the actio. block
RemoveInvalidPathChars(string)
Removes characters that cannot be used in file paths.
public static string RemoveInvalidPathChars(this string input)
Parameters
inputstringstring to be scanned
Returns
- string
inputwith invalid path characters removed.