Do
Provides utility methods to execute functions and actions under the invariant culture.
Métodos
public static void Invariant(Action action)
Do.Invariant(action)
Executes the specified action under the invariant culture.
- action
- The action to execute.
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.
Retorna: A task representing the asynchronous operation.
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.
Retorna: A task representing the asynchronous operation with the result.
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.
Retorna: The result of executing the function.
public static void Nothing()
Do.Nothing()
A no-op action that does nothing. Use instead of () => {}.
public static void Nothing<T>(T _)
Do.Nothing(_)
A no-op action that does nothing. Use instead of _ => {}.
public static void Nothing<T1, T2>(T1 _1, T2 _2)
Do.Nothing(_1, _2)
A no-op action that does nothing. Use instead of (_, _) => {}.
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 (_, _, _) => {}.
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 (_, _, _, _) => {}.
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.
Retorna: True if the Mutex is unique and acquired; otherwise, false.
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.
Retorna: An IDisposable that, when disposed, restores the original culture.
public static IDisposable WithInvariantCulture()
result = Do.WithInvariantCulture()
Temporarily sets the current thread's culture to the invariant culture.
Retorna: An IDisposable that, when disposed, restores the original culture.