JsNull.cs 712 B

12345678910111213141516171819202122232425262728293031323334353637
  1. using System;
  2. using Jint.Runtime;
  3. namespace Jint.Native
  4. {
  5. public sealed class JsNull : JsValue, IEquatable<JsNull>
  6. {
  7. internal JsNull() : base(Types.Null)
  8. {
  9. }
  10. public override object ToObject()
  11. {
  12. return null;
  13. }
  14. public override string ToString()
  15. {
  16. return "null";
  17. }
  18. public override bool Equals(JsValue obj)
  19. {
  20. if (ReferenceEquals(this, obj))
  21. {
  22. return true;
  23. }
  24. return obj is JsNull s && Equals(s);
  25. }
  26. public bool Equals(JsNull other)
  27. {
  28. return !ReferenceEquals(null, other);
  29. }
  30. }
  31. }