ETTaskVoid.cs 953 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. using System;
  2. using System.Runtime.CompilerServices;
  3. namespace ETModel
  4. {
  5. [AsyncMethodBuilder(typeof (ETAsyncTaskVoidMethodBuilder))]
  6. public struct ETTaskVoid
  7. {
  8. public void Forget()
  9. {
  10. }
  11. //[DebuggerHidden]
  12. public Awaiter GetAwaiter()
  13. {
  14. return new Awaiter();
  15. }
  16. public struct Awaiter: ICriticalNotifyCompletion
  17. {
  18. //[DebuggerHidden]
  19. public bool IsCompleted => true;
  20. //[DebuggerHidden]
  21. public void GetResult()
  22. {
  23. throw new Exception("ETTask can't await, always fire-and-forget. use Forget instead of await.");
  24. }
  25. //[DebuggerHidden]
  26. public void OnCompleted(Action continuation)
  27. {
  28. }
  29. //[DebuggerHidden]
  30. public void UnsafeOnCompleted(Action continuation)
  31. {
  32. }
  33. }
  34. }
  35. }