Resource.cs 378 B

1234567891011121314151617181920212223
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace UICommon.Helper;
  7. public class Resource
  8. {
  9. public static T? Get<T>(string key)
  10. {
  11. try
  12. {
  13. return (T)Application.Current.Resources[key];
  14. }
  15. catch
  16. {
  17. return default;
  18. }
  19. }
  20. }