终端一体化运控平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

28 lines
683 B

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace BPASmartClient.Academy._50L
  7. {
  8. public static class ExtendMethod
  9. {
  10. public static T GetValue<T>(this FeedbackData fbd) {
  11. if (PlcControl.GetInstance.Data.ContainsKey(fbd))
  12. {
  13. try
  14. {
  15. return (T)Convert.ChangeType(PlcControl.GetInstance.Data[fbd], typeof(T));
  16. }
  17. catch (Exception e) {
  18. return default(T);
  19. }
  20. }
  21. else {
  22. return default(T);
  23. }
  24. }
  25. }
  26. }