Do

Ecng.Common

Provides utility methods to execute functions and actions under the invariant culture.

Методы

Invariant
public static void Invariant(Action action)
Do.Invariant(action)

Executes the specified action under the invariant culture.

action
The action to execute.
InvariantAsync
public static Task InvariantAsync(Func<Task> actionAsync)
result = Do.InvariantAsync(actionAsync)

Executes the specified asynchronous action under the invariant culture.

actionAsync
The asynchronous action to execute.

Возвращает: A task representing the asynchronous operation.

InvariantAsync``1
public static Task<T> InvariantAsync<T>(Func<Task<T>> funcAsync)
result = Do.InvariantAsync(funcAsync)

Executes the specified asynchronous function under the invariant culture and returns its result.

funcAsync
The asynchronous function to execute.

Возвращает: A task representing the asynchronous operation with the result.

Invariant``1
public static T Invariant<T>(Func<T> func)
result = Do.Invariant(func)

Executes the specified function under the invariant culture and returns its result.

func
The function to execute.

Возвращает: The result of executing the function.

Nothing
public static void Nothing()
Do.Nothing()

A no-op action that does nothing. Use instead of () => {}.

Nothing``1
public static void Nothing<T>(T _)
Do.Nothing(_)

A no-op action that does nothing. Use instead of _ => {}.

Nothing``2
public static void Nothing<T1, T2>(T1 _1, T2 _2)
Do.Nothing(_1, _2)

A no-op action that does nothing. Use instead of (_, _) => {}.

Nothing``3
public static void Nothing<T1, T2, T3>(T1 _1, T2 _2, T3 _3)
Do.Nothing(_1, _2, _3)

A no-op action that does nothing. Use instead of (_, _, _) => {}.

Nothing``4
public static void Nothing<T1, T2, T3, T4>(T1 _1, T2 _2, T3 _3, T4 _4)
Do.Nothing(_1, _2, _3, _4)

A no-op action that does nothing. Use instead of (_, _, _, _) => {}.

TryGetUniqueMutex
public static bool TryGetUniqueMutex(string name, Mutex mutex)
result = Do.TryGetUniqueMutex(name, mutex)

Tries to get a unique Mutex with the specified name.

name
The name of the Mutex.
mutex
When this method returns, contains the Mutex if successful.

Возвращает: True if the Mutex is unique and acquired; otherwise, false.

WithCulture
public static IDisposable WithCulture(CultureInfo culture)
result = Do.WithCulture(culture)

Temporarily sets the current thread's culture to the specified culture.

culture
The CultureInfo to be set for the current thread.

Возвращает: An IDisposable that, when disposed, restores the original culture.

WithInvariantCulture
public static IDisposable WithInvariantCulture()
result = Do.WithInvariantCulture()

Temporarily sets the current thread's culture to the invariant culture.

Возвращает: An IDisposable that, when disposed, restores the original culture.