Table of Contents

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

task Task

The 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

enumerable IEnumerable<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

actionBlock ActionBlock<TInput>

Instance of ActionBlock

input TInput

Object to be posted

delay TimeSpan

Time to wait before posting

Returns

Task<bool>

Type Parameters

TInput

Type 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

input string

string to be scanned

Returns

string

input with invalid path characters removed.