Advertisement
Guest User

Untitled

a guest
Sep 15th, 2019
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. public class Import
  2. {
  3. private static object ImportLock = new object();
  4. private static DateTime LastImport = DateTime.MinValue;
  5.  
  6. public static ImportInfo Import()
  7. {
  8. lock (ImportLock)
  9. {
  10. if (DateTime.Now.AddSeconds(-10) < LastImport)
  11. {
  12. return "no import - time lock";
  13. }
  14.  
  15. LastImport = DateTime.Now;
  16. return "imported";
  17. }
  18. }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement