Unit.cs 864 B

12345678910111213141516171819202122232425262728293031323334
  1. // Licensed to the .NET Foundation under one or more agreements.
  2. // The .NET Foundation licenses this file to you under the MIT license.
  3. // See the LICENSE file in the project root for more information.
  4. using System;
  5. using System.Runtime.CompilerServices;
  6. namespace CommunityToolkit.Mvvm.Messaging.Internals;
  7. /// <summary>
  8. /// An empty type representing a generic token with no specific value.
  9. /// </summary>
  10. internal readonly struct Unit : IEquatable<Unit>
  11. {
  12. /// <inheritdoc/>
  13. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  14. public bool Equals(Unit other)
  15. {
  16. return true;
  17. }
  18. /// <inheritdoc/>
  19. public override bool Equals(object? obj)
  20. {
  21. return obj is Unit;
  22. }
  23. /// <inheritdoc/>
  24. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  25. public override int GetHashCode()
  26. {
  27. return 0;
  28. }
  29. }