You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

SymbolExtensions.cs 735 B

123456789101112131415161718192021222324252627
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Diagnostics.SymbolStore;
  5. using Microsoft.CodeAnalysis;
  6. namespace Discord.Net.SourceGenerators.Serialization
  7. {
  8. internal static class SymbolExtensions
  9. {
  10. public static IEnumerable<IPropertySymbol> GetProperties(
  11. this INamedTypeSymbol symbol,
  12. bool includeInherited)
  13. {
  14. var s = symbol;
  15. do
  16. {
  17. foreach (var member in s.GetMembers())
  18. if (member is IPropertySymbol property)
  19. yield return property;
  20. s = s.BaseType;
  21. }
  22. while (includeInherited && s != null);
  23. }
  24. }
  25. }

No Description