private static Task LanguageTask = null; public static Task SetLanguage(Language language) { if (LanguageTask == null) { LanguageTask = Task.Run(async () => { DefaultTranslations = await GetExistingLabels(Language.Default); CurrentTranslations = await GetExistingLabels(language); }); } return LanguageTask; }
291400cookie-checkC# Run a task only once