GuidExtension.cs 574 B

1234567891011121314151617181920
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Threading.Tasks;
  5. namespace GreenTree.Strohrmann.ERP.Core.Extension
  6. {
  7. public static class GuidExtension
  8. {
  9. /// <summary>
  10. /// Converts the GUID to a short version
  11. /// </summary>
  12. /// <param name="guid">The GUID object.</param>
  13. /// <returns>The first part until the first hyphen of the regular GUID.</returns>
  14. public static string ToShortString(this Guid guid)
  15. {
  16. return guid.ToString().Split('-')[0];
  17. }
  18. }
  19. }