2
0

UuidConverter.cs 549 B

1234567891011121314151617181920212223242526
  1. using Jint.Native;
  2. using Jint.Runtime.Interop;
  3. using System;
  4. namespace Jint.Tests.Runtime.Domain
  5. {
  6. public class UuidConverter : IObjectConverter
  7. {
  8. internal UuidConverter()
  9. {
  10. }
  11. public bool TryConvert(Engine engine, object value, out JsValue result)
  12. {
  13. switch (value)
  14. {
  15. case Guid g:
  16. result = new JsUuid(g);
  17. return true;
  18. }
  19. result = JsValue.Undefined;
  20. return false;
  21. }
  22. }
  23. }