CommonAtrr.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. using YG;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.IO;
  5. using System.Linq;
  6. using System.Runtime.Serialization;
  7. using System.Runtime.Serialization.Formatters.Binary;
  8. using System.Text;
  9. using System.Threading.Tasks;
  10. using System.ComponentModel;
  11. using System.Net.NetworkInformation;
  12. using IMCS.CCS;
  13. namespace System.Text
  14. {
  15. public class Notify : System.ComponentModel.INotifyPropertyChanged
  16. {
  17. public event PropertyChangedEventHandler PropertyChanged;
  18. public void NotifyProper(string name)
  19. {
  20. if (PropertyChanged != null)
  21. {
  22. PropertyChanged.Invoke(this, new PropertyChangedEventArgs(name));
  23. }
  24. }
  25. }
  26. public static class CommonAtrr
  27. {
  28. public static bool FirstOrDefaultYG<TSource>(this TSource source, Action<TSource> action)
  29. {
  30. if (source != null)
  31. {
  32. try
  33. {
  34. action(source);
  35. return true;
  36. }
  37. catch
  38. {
  39. Log.Instance.WriteLogAdd("执行FirstOrDefaultYG函数时出现异常情况");
  40. return false;
  41. }
  42. }
  43. return false;
  44. }
  45. }
  46. }